blob: 7ad5fb3e9ec3c47808fd273f9b63b85275e183d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import java.io._
import java.util.zip._
class C {
def isWrapper(is: FileInputStream): InputStream = {
val pb = new PushbackInputStream(is, 2)
val signature = new Array[Byte](2)
pb.read(signature)
pb.unread(signature)
if (signature.sameElements(Array(0x1F, 0x8B))) {
new GZIPInputStream(new BufferedInputStream(pb))
} else {
pb
}
}
}
|