@Override public boolean isAvailable() { try { buffer(); } catch (IOException e) { Context.getCurrentLogger().log(Level.FINER, "Unable to buffer the wrapped representation", e); } return isBuffered(); }
/** * 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); } } }