本文整理汇总了Java中java.io.PrintWriter.checkError方法的典型用法代码示例。如果您正苦于以下问题:Java PrintWriter.checkError方法的具体用法?Java PrintWriter.checkError怎么用?Java PrintWriter.checkError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PrintWriter
的用法示例。
在下文中一共展示了PrintWriter.checkError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeNodeViz
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Returns the String representation of an AlloyNodeElement's settings. */
private static String writeNodeViz(VizState view, VizState defaultView, AlloyNodeElement x) throws IOException {
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
writeBool(out, "visible", view.nodeVisible.get(x), defaultView.nodeVisible.get(x));
writeBool(out, "hideunconnected", view.hideUnconnected.get(x), defaultView.hideUnconnected.get(x));
if (x == null || x instanceof AlloySet) {
AlloySet s = (AlloySet) x;
writeBool(out, "showlabel", view.showAsLabel.get(s), defaultView.showAsLabel.get(s));
writeBool(out, "showinattr", view.showAsAttr.get(s), defaultView.showAsAttr.get(s));
}
if (x == null || x instanceof AlloyType) {
AlloyType t = (AlloyType) x;
writeBool(out, "numberatoms", view.number.get(t), defaultView.number.get(t));
}
writeDotStyle(out, view.nodeStyle.get(x), defaultView.nodeStyle.get(x));
writeDotShape(out, view.shape.get(x), defaultView.shape.get(x));
writeDotColor(out, view.nodeColor.get(x), defaultView.nodeColor.get(x));
if (x != null && !view.label.get(x).equals(defaultView.label.get(x)))
Util.encodeXMLs(out, " label=\"", view.label.get(x), "\"");
if (out.checkError())
throw new IOException("PrintWriter IO Exception!");
return sw.toString();
}
示例2: writeEdgeViz
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Returns the String representation of an AlloyRelation's settings. */
private static String writeEdgeViz(VizState view, VizState defaultView, AlloyRelation x) throws IOException {
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
writeDotColor(out, view.edgeColor.get(x), defaultView.edgeColor.get(x));
writeDotStyle(out, view.edgeStyle.get(x), defaultView.edgeStyle.get(x));
writeBool(out, "visible", view.edgeVisible.get(x), defaultView.edgeVisible.get(x));
writeBool(out, "merge", view.mergeArrows.get(x), defaultView.mergeArrows.get(x));
writeBool(out, "layout", view.layoutBack.get(x), defaultView.layoutBack.get(x));
writeBool(out, "attribute", view.attribute.get(x), defaultView.attribute.get(x));
writeBool(out, "constraint", view.constraint.get(x), defaultView.constraint.get(x));
if (view.weight.get(x) != defaultView.weight.get(x))
out.write(" weight=\"" + view.weight.get(x) + "\"");
if (x != null && !view.label.get(x).equals(defaultView.label.get(x)))
Util.encodeXMLs(out, " label=\"", view.label.get(x), "\"");
if (out.checkError())
throw new IOException("PrintWriter IO Exception!");
return sw.toString();
}
示例3: writeInstance
import java.io.PrintWriter; //导入方法依赖的package包/类
/**
* If this solution is a satisfiable solution, this method will write it out
* in XML format.
*/
static void writeInstance(A4Reporter rep, A4Solution sol, PrintWriter out, Iterable<Func> extraSkolems,
Map<String,String> sources) throws Err {
if (!sol.satisfiable())
throw new ErrorAPI("This solution is unsatisfiable.");
try {
Util.encodeXMLs(out, "<alloy builddate=\"", Version.buildDate(), "\">\n\n");
new A4SolutionWriter(rep, sol, sol.getAllReachableSigs(), sol.getBitwidth(), sol.getMaxSeq(),
sol.getOriginalCommand(), sol.getOriginalFilename(), out, extraSkolems);
if (sources != null)
for (Map.Entry<String,String> e : sources.entrySet()) {
Util.encodeXMLs(out, "\n<source filename=\"", e.getKey(), "\" content=\"", e.getValue(), "\"/>\n");
}
out.print("\n</alloy>\n");
} catch (Throwable ex) {
if (ex instanceof Err)
throw (Err) ex;
else
throw new ErrorFatal("Error writing the solution XML file.", ex);
}
if (out.checkError())
throw new ErrorFatal("Error writing the solution XML file.");
}
示例4: _endCssFile
import java.io.PrintWriter; //导入方法依赖的package包/类
/**
* outputs the footer for a css file
* @param out
* @param styleSheetName
* @param compressStyles
* @param fileSelectorsWritten
*/
private static void _endCssFile(PrintWriter out, String styleSheetName, boolean compressStyles, int fileSelectorsWritten)
{
if (!compressStyles)
{
out.print("/* The number of CSS selectors in this file is ");
out.print(fileSelectorsWritten);
out.println(" */");
}
if (out.checkError())
{
_LOG.severe("Error writing stylesheet:" + styleSheetName);
}
out.close();
}
示例5: writeNodeViz
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Returns the String representation of an AlloyNodeElement's settings. */
private static String writeNodeViz(VizState view, VizState defaultView, AlloyNodeElement x) throws IOException {
StringWriter sw=new StringWriter();
PrintWriter out=new PrintWriter(sw);
writeBool(out, "visible", view.nodeVisible.get(x), defaultView.nodeVisible.get(x));
writeBool(out, "hideunconnected", view.hideUnconnected.get(x), defaultView.hideUnconnected.get(x));
if (x==null || x instanceof AlloySet) {
AlloySet s=(AlloySet)x;
writeBool(out, "showlabel", view.showAsLabel.get(s), defaultView.showAsLabel.get(s));
writeBool(out, "showinattr", view.showAsAttr.get(s), defaultView.showAsAttr.get(s));
}
if (x==null || x instanceof AlloyType) {
AlloyType t=(AlloyType)x;
writeBool(out, "numberatoms", view.number.get(t), defaultView.number.get(t));
}
writeDotStyle(out, view.nodeStyle.get(x), defaultView.nodeStyle.get(x));
writeDotShape(out, view.shape.get(x), defaultView.shape.get(x));
writeDotColor(out, view.nodeColor.get(x), defaultView.nodeColor.get(x));
if (x!=null && !view.label.get(x).equals(defaultView.label.get(x)))
Util.encodeXMLs(out, " label=\"", view.label.get(x), "\"");
if (out.checkError()) throw new IOException("PrintWriter IO Exception!");
return sw.toString();
}
示例6: writeEdgeViz
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Returns the String representation of an AlloyRelation's settings. */
private static String writeEdgeViz(VizState view, VizState defaultView, AlloyRelation x) throws IOException {
StringWriter sw=new StringWriter();
PrintWriter out=new PrintWriter(sw);
writeDotColor(out, view.edgeColor.get(x), defaultView.edgeColor.get(x));
writeDotStyle(out, view.edgeStyle.get(x), defaultView.edgeStyle.get(x));
writeBool(out, "visible", view.edgeVisible.get(x), defaultView.edgeVisible.get(x));
writeBool(out, "merge", view.mergeArrows.get(x), defaultView.mergeArrows.get(x));
writeBool(out, "layout", view.layoutBack.get(x), defaultView.layoutBack.get(x));
writeBool(out, "attribute", view.attribute.get(x), defaultView.attribute.get(x));
writeBool(out, "constraint",view.constraint.get(x), defaultView.constraint.get(x));
if (view.weight.get(x) != defaultView.weight.get(x)) out.write(" weight=\"" + view.weight.get(x) + "\"");
if (x!=null && !view.label.get(x).equals(defaultView.label.get(x)))
Util.encodeXMLs(out, " label=\"", view.label.get(x), "\"");
if (out.checkError()) throw new IOException("PrintWriter IO Exception!");
return sw.toString();
}
示例7: writeXML
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Helper method to write out a full XML file. */
public void writeXML(A4Reporter rep, PrintWriter writer, Iterable<Func> macros, Map<String,String> sourceFiles)
throws Err {
A4SolutionWriter.writeInstance(rep, this, writer, macros, sourceFiles);
if (writer.checkError())
throw new ErrorFatal("Error writing the solution XML file.");
}
示例8: writeMetamodel
import java.io.PrintWriter; //导入方法依赖的package包/类
/**
* Write the metamodel as <instance>..</instance> in XML format.
*/
public static void writeMetamodel(ConstList<Sig> sigs, String originalFilename, PrintWriter out) throws Err {
try {
new A4SolutionWriter(null, null, sigs, 4, 4, "show metamodel", originalFilename, out, null);
} catch (Throwable ex) {
if (ex instanceof Err)
throw (Err) ex;
else
throw new ErrorFatal("Error writing the solution XML file.", ex);
}
if (out.checkError())
throw new ErrorFatal("Error writing the solution XML file.");
}
示例9: sendPobiRequest
import java.io.PrintWriter; //导入方法依赖的package包/类
@SuppressWarnings("unused")
private void sendPobiRequest(Socket socket) throws IOException {
Engine.logEmulators.trace("[JsseSesureSocketImpl] Retrieving Pobi Fiben Home page...");
PrintWriter out = new PrintWriter(
new BufferedWriter(
new OutputStreamWriter(
socket.getOutputStream())));
out.println("GET " + "/fiben/home.aspx" + " HTTP/1.0");
out.println();
out.flush();
if (out.checkError())
Engine.logEmulators.trace("[JsseSesureSocketImpl] java.io.PrintWriter error");
BufferedReader in = new BufferedReader(
new InputStreamReader(
socket.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
Engine.logEmulators.trace("[JsseSesureSocketImpl] "+inputLine);
in.close();
out.close();
socket.close();
throw new IOException("Socket has been closed");
}
示例10: StringWriter
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Given a Kodkod formula node, return a Java program that (when compiled and executed) would solve that formula.
*
* <p> Requirement: atoms must be String objects (since we cannot possibly
* output a Java source code that can re-generate arbitrary Java objects).
*
* @param formula - the formula to convert
* @param bitwidth - the integer bitwidth
* @param atoms - an iterator over the set of all atoms
* @param bounds - the Kodkod bounds object to use
* @param atomMap - if nonnull, it is used to map the atom name before printing
*/
public static String convert
(Formula formula, int bitwidth, Iterable<String> atoms, Bounds bounds, Map<Object,String> atomMap) {
StringWriter string=new StringWriter();
PrintWriter file=new PrintWriter(string);
new TranslateKodkodToJava(file, formula, bitwidth, atoms, bounds, atomMap);
if (file.checkError()) {
return ""; // shouldn't happen
} else {
return string.toString();
}
}
示例11: writeInstance
import java.io.PrintWriter; //导入方法依赖的package包/类
/** If this solution is a satisfiable solution, this method will write it out in XML format. */
static void writeInstance(A4Reporter rep, A4Solution sol, PrintWriter out, Iterable<Func> extraSkolems, Map<String,String> sources) throws Err {
if (!sol.satisfiable()) throw new ErrorAPI("This solution is unsatisfiable.");
try {
Util.encodeXMLs(out, "<alloy builddate=\"", Version.buildDate(), "\">\n\n");
new A4SolutionWriter(rep, sol, sol.getAllReachableSigs(), sol.getBitwidth(), sol.getMaxSeq(), sol.getOriginalCommand(), sol.getOriginalFilename(), out, extraSkolems);
if (sources!=null) for(Map.Entry<String,String> e: sources.entrySet()) {
Util.encodeXMLs(out, "\n<source filename=\"", e.getKey(), "\" content=\"", e.getValue(), "\"/>\n");
}
out.print("\n</alloy>\n");
} catch(Throwable ex) {
if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Error writing the solution XML file.", ex);
}
if (out.checkError()) throw new ErrorFatal("Error writing the solution XML file.");
}
示例12: writeMetamodel
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Write the metamodel as <instance>..</instance> in XML format. */
public static void writeMetamodel(ConstList<Sig> sigs, String originalFilename, PrintWriter out) throws Err {
try {
new A4SolutionWriter(null, null, sigs, 4, 4, "show metamodel", originalFilename, out, null);
} catch(Throwable ex) {
if (ex instanceof Err) throw (Err)ex; else throw new ErrorFatal("Error writing the solution XML file.", ex);
}
if (out.checkError()) throw new ErrorFatal("Error writing the solution XML file.");
}
示例13: printDOT
import java.io.PrintWriter; //导入方法依赖的package包/类
/**
* Print a DOT representation of search graph.
*
* @param file file where to print the DOT representation to.
*
* @throws IllegalArgumentException if {@code file} is {@code null}.
* @throws FileNotFoundException if {@code file} cannot be created or written.
* @throws IllegalStateException if there was some trouble when writing the DOT representation.
*/
public void printDOT(final File file) throws FileNotFoundException {
if (file == null)
throw new IllegalArgumentException("the output file cannot be null");
final PrintWriter out = new PrintWriter(file);
printDOT(out);
if (out.checkError())
throw new IllegalStateException("error occurred while writing k-best haplotype search graph into file '"
+ file.getAbsolutePath() + "'");
out.close();
}
示例14: writeXML
import java.io.PrintWriter; //导入方法依赖的package包/类
/** Helper method to write out a full XML file. */
public void writeXML(PrintWriter writer, Iterable<Func> macros, Map<String,String> sourceFiles) throws Err {
A4SolutionWriter.writeInstance(null, this, writer, macros, sourceFiles);
if (writer.checkError()) throw new ErrorFatal("Error writing the solution XML file.");
}
示例15: run
import java.io.PrintWriter; //导入方法依赖的package包/类
public void run() {//run method is called
//Create message acceptor thread
MessageAcceptor ma = new MessageAcceptor(clientSocket);//ma is a message acceptor and it takes in the clientSocket parameter
new Thread(ma).start();//ma is a new thread and calls on the start method
boolean running = true;//running is a true boolean
try {
while (running) {//try that while running is going, the pw will be a new socket from the output message
if (running) {
//Create a writer to pass messages from client to server
PrintWriter pw = new PrintWriter(clientSocket.getOutputStream());
//for reading input text
BufferedReader msgTaker = new BufferedReader(new InputStreamReader(System.in));//msgTaker reads through the input stream
System.out.println("");//print out a blank statement
long end=System.currentTimeMillis()+1500;//end prints out the time +1500
//non-blocking text input such that the user is given some time to enter a message
String message = "";
while((System.currentTimeMillis()<end)) {//while the time is less than the end
if (msgTaker.ready())//if the buffered reader calls on the ready method
message += msgTaker.readLine();//concatinate the following
}
//Message handling - non blocking
if (message.equals("")) {//if the message is still blank
System.out.println("No input on socket: " + clientSocket.getLocalAddress().toString());
}//the following will print out
else {
System.out.println("The message is " + message + " on socket " + clientSocket.getLocalAddress().toString());
}
pw.println(message);
//Check if client disconnected
if (pw.checkError()) {//if the pw calls on the error message
running = false;//running is false
System.out.println("Cliented disconnected");
}
pw.flush();//flush out the print writer
}
}
clientSocket.close();//close connection with the client socket
} catch (IOException ioe) {//catch the following exception
ioe.printStackTrace();//print stack trace
System.out.println("Error connecting");//error messge will pop up
}
}