private COSStream getStream(Map<String, COSStream> streams, Token token) throws IOException { COSStream stream = streams.get(token.getDSSIdAsString()); if (stream == null) { RandomAccessBuffer storage = new RandomAccessBuffer(); stream = new COSStream(storage); OutputStream unfilteredStream = stream.createUnfilteredStream(); unfilteredStream.write(token.getEncoded()); unfilteredStream.flush(); streams.put(token.getDSSIdAsString(), stream); } return stream; }
/** * This will create an output stream that can be written to. * * @return An output stream which raw data bytes should be written to. * @throws IOException If there is an error creating the stream. */ public OutputStream createUnfilteredStream() throws IOException { return firstStream.createUnfilteredStream(); }