nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/compression/CompressionDescriptor.java
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;
    }
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;
    }
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
@param byteBuffer the bytebuffer to instantiate
the descriptor from
@return the instantiated descriptor based on the given
bytebuffer
Instantiate a compression descriptor from the given bytebuffer