/** * Buffers the content of the wrapped entity. * * @throws IOException */ private void buffer() throws IOException { if (!isBuffered()) { if (getWrappedRepresentation().isAvailable()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); getWrappedRepresentation().write(baos); baos.flush(); setBuffer(baos.toByteArray()); setBuffered(true); } } }