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