This will take an array of streams and sequence them together.
Method from org.apache.pdfbox.pdmodel.common.COSStreamArray Detail: |
public Object accept(ICOSVisitor visitor) throws COSVisitorException {
return streams.accept( visitor );
}
visitor pattern double dispatch method. |
public void appendStream(COSStream streamToAppend) {
streams.add(streamToAppend);
}
Appends a new stream to the array that represents this object's stream. |
public OutputStream createFilteredStream() throws IOException {
return firstStream.createFilteredStream();
}
This will create a new stream for which filtered byte should be
written to. You probably don't want this but want to use the
createUnfilteredStream, which is used to write raw bytes to. |
public OutputStream createFilteredStream(COSBase expectedLength) throws IOException {
return firstStream.createFilteredStream( expectedLength );
}
This will create a new stream for which filtered byte should be
written to. You probably don't want this but want to use the
createUnfilteredStream, which is used to write raw bytes to. |
public OutputStream createUnfilteredStream() throws IOException {
return firstStream.createUnfilteredStream();
}
This will create an output stream that can be written to. |
public COSBase get(int index) {
return streams.get( index );
}
This will get a stream (or the reference to a stream) from the array. |
public COSDictionary getDictionary() {
return firstStream;
}
This will get the dictionary that is associated with this stream. |
public COSBase getDictionaryObject(COSName key) {
return firstStream.getDictionaryObject( key );
}
This will get an object from this streams dictionary and dereference it
if necessary. |
public InputStream getFilteredStream() throws IOException {
throw new IOException( "Error: Not allowed to get filtered stream from array of streams." );
/**
Vector inputStreams = new Vector();
byte[] inbetweenStreamBytes = "\n".getBytes();
for( int i=0;i< streams.size(); i++ )
{
COSStream stream = (COSStream)streams.getObject( i );
}
return new SequenceInputStream( inputStreams.elements() );
**/
}
This will get the stream with all of the filters applied. |
public COSBase getFilters() {
return firstStream.getFilters();
}
This will return the filters to apply to the byte stream
the method will return.
- null if no filters are to be applied
- a COSName if one filter is to be applied
- a COSArray containing COSNames if multiple filters are to be applied |
public COSBase getItem(COSName key) {
return firstStream.getItem( key );
}
This will get an object from this streams dictionary. |
public RandomAccess getScratchFile() {
return firstStream.getScratchFile();
}
This will get the scratch file associated with this stream. |
public int getStreamCount() {
return streams.size();
}
This will get the number of streams in the array. |
public List getStreamTokens() throws IOException {
List retval = null;
if( streams.size() > 0 )
{
PDFStreamParser parser = new PDFStreamParser( this );
parser.parse();
retval = parser.getTokens();
}
else
{
retval = new ArrayList();
}
return retval;
}
This will get all the tokens in the stream. |
public InputStream getUnfilteredStream() throws IOException {
Vector inputStreams = new Vector();
byte[] inbetweenStreamBytes = "\n".getBytes();
for( int i=0;i< streams.size(); i++ )
{
COSStream stream = (COSStream)streams.getObject( i );
inputStreams.add( stream.getUnfilteredStream() );
//handle the case where there is no whitespace in the
//between streams in the contents array, without this
//it is possible that two operators will get concatenated
//together
inputStreams.add( new ByteArrayInputStream( inbetweenStreamBytes ) );
}
return new SequenceInputStream( inputStreams.elements() );
}
This will get the logical content stream with none of the filters. |
public void setFilters(COSBase filters) throws IOException {
//should this be allowed? Should this
//propagate to all streams in the array?
firstStream.setFilters( filters );
}
set the filters to be applied to the stream. |
public String toString() {
String result = "COSStream{}";
return result;
}
|