1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.rest.filter;
21
22 import java.io.IOException;
23 import java.util.zip.GZIPInputStream;
24
25 import javax.servlet.ServletInputStream;
26 import javax.servlet.http.HttpServletRequest;
27
28 import org.apache.hadoop.hbase.classification.InterfaceAudience;
29
30 @InterfaceAudience.Private
31 public class GZIPRequestStream extends ServletInputStream
32 {
33 private GZIPInputStream in;
34
35 public GZIPRequestStream(HttpServletRequest request) throws IOException {
36 this.in = new GZIPInputStream(request.getInputStream());
37 }
38
39 @Override
40 public int read() throws IOException {
41 return in.read();
42 }
43
44 @Override
45 public int read(byte[] b) throws IOException {
46 return in.read(b);
47 }
48
49 @Override
50 public int read(byte[] b, int off, int len) throws IOException {
51 return in.read(b, off, len);
52 }
53
54 @Override
55 public void close() throws IOException {
56 in.close();
57 }
58 }