apurtell commented on a change in pull request #3691:
URL: https://github.com/apache/hbase/pull/3691#discussion_r718668098
##########
File path:
hbase-common/src/main/java/org/apache/hadoop/hbase/io/compress/Compression.java
##########
@@ -470,4 +551,41 @@ public static void decompress(ByteBuff dest, InputStream
bufferedBoundedStream,
}
}
}
+
+ public static CompressionCodec buildCodec(final Configuration conf, final
Algorithm algo) {
+ try {
+ String codecClassName = conf.get(algo.confKey, algo.confDefault);
+ if (codecClassName == null) {
+ throw new RuntimeException("No codec configured for " + algo.confKey);
+ }
+ Class<?> codecClass = getClassLoaderForCodec().loadClass(codecClassName);
+ CompressionCodec codec = (CompressionCodec)
ReflectionUtils.newInstance(codecClass,
+ new Configuration(conf));
+ LOG.info("Loaded codec {} for compression algorithm {}",
+ codec.getClass().getCanonicalName(), algo.name());
+ return codec;
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
Review comment:
Also just test code, who cares.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]