@ Override public void compress ( final List < ByteBuf > source , final BsonOutput target ) { int uncompressedSize = getUncompressedSize ( source ) ; byte [ ] singleByteArraySource = new byte [ uncompressedSize ] ; copy ( source , singleByteArraySource ) ; try { byte [ ] out = new byte [ Snappy . maxCompressedLength ( uncompressedSize ) ] ; int compressedSize = Snappy . compress ( singleByteArraySource , 0 , singleByteArraySource . length , out , 0 ) ; target . writeBytes ( out , 0 , compressedSize ) ; } catch ( IOException e ) { throw new MongoInternalException ( "Unexpected IOException" , e ) ; } }
be copied into a single byte array . For that reason the compress method defined in the base class can t be used .