@Override public String toString() { return getClass().getName() + " size: " + size() + " pos: " + getPosition(); }
/** * Gets a copy of the buffered bytes. * * @return the byte array * @see org.bson.io.OutputBuffer#pipe(java.io.OutputStream) */ public byte[] toByteArray() { try { ByteArrayOutputStream bout = new ByteArrayOutputStream(size()); pipe(bout); return bout.toByteArray(); } catch (IOException ioe) { throw new RuntimeException("should be impossible", ioe); } }
/** * mostly for testing */ public byte[] toByteArray() { try { final ByteArrayOutputStream bout = new ByteArrayOutputStream(size()); pipe(bout); return bout.toByteArray(); } catch (IOException ioe) { throw new RuntimeException("should be impossible", ioe); } }
@Override public String toString() { return getClass().getName() + " size: " + size() + " pos: " + getPosition(); } }