/** * <p>Get the CompressionType enumeration value by * passing the byte identifier to this method.</p> * * @param byteIdentifier of CompressionType. * * @return CompressionType instance. * * @throws IllegalArgumentException If CompressionType cannot be found for the * provided byteIdentifier */ public static CompressionType getCompressionType(byte byteIdentifier) { for (final CompressionType compressionType : CompressionType.values()) { if (compressionType.getValue() == byteIdentifier) { return compressionType; } } throw new IllegalArgumentException( "Illegal value provided for CompressionType."); }
/** * <p>Get the CompressionType enumeration value by * passing the library name to this method.</p> * * <p>If library cannot be found the enumeration * value {@code NO_COMPRESSION} will be returned.</p> * * @param libraryName compression library name. * * @return CompressionType instance. */ public static CompressionType getCompressionType(String libraryName) { if (libraryName != null) { for (CompressionType compressionType : CompressionType.values()) { if (compressionType.getLibraryName() != null && compressionType.getLibraryName().equals(libraryName)) { return compressionType; } } } return CompressionType.NO_COMPRESSION; }
final String tmpDir = System.getenv("ROCKSDB_SHAREDLIB_DIR"); for (final CompressionType compressionType : CompressionType.values()) { try { if (compressionType.getLibraryName() != null) {
for (final CompressionType compressionType : CompressionType.values()) { if (compressionType.equals(CompressionType.NO_COMPRESSION)) { continue;