public void close() throws IOException {
  if (writer != null) {
    writer.close();
  }
 else {
    cb=null;
    closed=true;
  }
}

public void close ( ) throws IOException { if ( writer != null ) { writer . close ( ) ; } else { cb = null ; closed = true ; } }
close the stream , flushing it first . once a stream has been closed , further write ( ) or flush ( ) invocations will cause an ioexception to be thrown . closing a previously - closed stream , however , has no effect .
