Code example for PrintStream

Methods: checkError

0
 
  private PrintStream stream;
  private boolean isFirst = true;
     
  private void throwExceptionOnError(String tag) throws IOException {
    if (stream.checkError()) {
      throw new IOException("Error serializing "+tag);
    } 
  } 
  
  private void printCommaUnlessFirst() { 
    if (!isFirst) {
      stream.print(",");
    } 
    isFirst = false;
  } 
     
  /** Creates a new instance of CsvRecordOutput */ 
  public CsvRecordOutput(OutputStream out) {
    try { 
      stream = new PrintStream(out, true, "UTF-8");