byte[] buffer = new byte[ BUFFER_SIZE ];
int amountRead = 0;
if( contentsArray.size() > 0 )
{
COSObject first = (COSObject)contentsArray.get( 0 );
COSStream firstStream = (COSStream)first.getObject();
COSStream tmpStream =
new COSStream( firstStream.getDictionary(),
firstStream.getScratchFile() );
OutputStream output = tmpStream.createUnfilteredStream();
for( int i=0; i<contentsArray.size(); i++ )
{
COSObject obj = (COSObject)contentsArray.get( i );
COSStream content = (COSStream)obj.getObject();
InputStream input = content.getUnfilteredStream();
while ( (amountRead = input.read(buffer, 0, BUFFER_SIZE)) != -1)
{
output.write(buffer, 0, amountRead);
}
//handle the case where there is no whitespace in the