/** * Returns instance of FastBufferOutputStream containing all data written to this writer. * * @return */ public FastBufferOutputStream convertToOutputStream() { CharBuffer c = firstBuffer; ByteBuffer first = c.toByteBuffer(); ByteBuffer b = first; while (c != null) { c = c.getNext(); if (c == null) { break; } ByteBuffer n = c.toByteBuffer(); b.setNext(n); b = n; } return new FastBufferOutputStream(first); }
/** * Returns instance of FastBufferOutputStream containing all data written to this writer. * * @param encoding * @return * @throws UnsupportedEncodingException */ public FastBufferOutputStream convertToOutputStream(String encoding) throws UnsupportedEncodingException { CharBuffer c = firstBuffer; ByteBuffer first = c.toByteBuffer(encoding); ByteBuffer b = first; while (c != null) { c = c.getNext(); if (c == null) { break; } ByteBuffer n = c.toByteBuffer(encoding); b.setNext(n); b = n; } return new FastBufferOutputStream(first); }