blob: a689884db0aca10e224bc0184642e0b0b106c97f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.compress;
/**
* Compression type enum.
*
* @author bratseth
*/
public enum CompressionType {
// Do not change the type->ordinal association. The gap is due to historic types no longer supported.
NONE((byte) 0),
INCOMPRESSIBLE((byte) 5),
LZ4((byte) 6);
private byte code;
CompressionType(byte code) {
this.code = code;
}
public byte getCode() {
return code;
}
/**
* Returns whether this type represent actually compressed data
*/
public boolean isCompressed() {
return this != NONE && this != INCOMPRESSIBLE;
}
public static CompressionType valueOf(byte value) {
switch (value) {
case ((byte) 0):
return NONE;
case ((byte) 5):
return INCOMPRESSIBLE;
case ((byte) 6):
return LZ4;
default:
throw new IllegalArgumentException("Unknown compression type ordinal " + value);
}
}
}
|