Code example for PrintStream

Methods: append

0
  @Override 
  public void write(char[] cbuf, int off, int len) throws IOException {
    if (off == 0 && len == cbuf.length)
      stream.print(cbuf);
    else 
      stream.append(CharBuffer.wrap(cbuf, off, len));
  } 
 
  @Override 
  public void write(String str, int off, int len) throws IOException {
    stream.append(str, off, len);
  } 
 
}