currentObjectKey.getGeneration());
}
InputStream input = obj.getFilteredStream();
// set the length of the stream and write stream dictionary
COSObject lengthObject = new COSObject( null );
obj.setItem(COSName.LENGTH, lengthObject);
//obj.accept(this);
// write the stream content
visitFromDictionary( obj );
getStandardOutput().write(STREAM);
getStandardOutput().writeCRLF();
byte[] buffer = new byte[1024];
int amountRead = 0;
int totalAmountWritten = 0;
while( (amountRead = input.read(buffer,0,1024)) != -1 )
{
getStandardOutput().write( buffer, 0, amountRead );
totalAmountWritten += amountRead;
}
lengthObject.setObject( new COSInteger( totalAmountWritten ) );
getStandardOutput().writeCRLF();
getStandardOutput().write(ENDSTREAM);
getStandardOutput().writeEOL();
return null;
}