@Override public byte[] toBuffer() { try { if (content == null) return null; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] b = new byte[BUFFER_SIZE]; int len = 0; while ((len = content.read(b)) != -1) { buffer.write(b, 0, len); } content.close(); b = buffer.toByteArray(); fromBuffer(b); return b; } catch (IOException e) { throw new MarkLogicIOException(e); } } /**
@Override public byte[] toBuffer() { try { if (content == null) return null; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); byte[] b = new byte[BUFFER_SIZE]; int len = 0; while ((len = content.read(b)) != -1) { buffer.write(b, 0, len); } content.close(); b = buffer.toByteArray(); fromBuffer(b); return b; } catch (IOException e) { throw new MarkLogicIOException(e); } } /**
inputStreamH.fromBuffer(before); after = inputStreamH.toBuffer(); assertNotNull("InputStream after",after);