public static CompressionDescriptor fromByteBuffer ( ByteBuffer byteBuffer ) { CompressionDescriptor compressionDescriptor = new CompressionDescriptor ( ) ; //compression opType int compressionTypeOrdinal = byteBuffer . getInt ( ) ; CompressionType compressionType = CompressionType . values ( ) [ compressionTypeOrdinal ] ; compressionDescriptor . setCompressionType ( compressionType ) ; //compression algo int compressionAlgoOrdinal = byteBuffer . getInt ( ) ; CompressionAlgorithm compressionAlgorithm = CompressionAlgorithm . values ( ) [ compressionAlgoOrdinal ] ; compressionDescriptor . setCompressionAlgorithm ( compressionAlgorithm . name ( ) ) ; //from here everything is longs compressionDescriptor . setOriginalLength ( byteBuffer . getLong ( ) ) ; compressionDescriptor . setCompressedLength ( byteBuffer . getLong ( ) ) ; compressionDescriptor . setNumberOfElements ( byteBuffer . getLong ( ) ) ; compressionDescriptor . setOriginalElementSize ( byteBuffer . getLong ( ) ) ; return compressionDescriptor ; }
Instantiate a compression descriptor from the given bytebuffer