MCPcopy Create free account
hub / github.com/apache/orc / decompress

Method decompress

java/core/src/java/org/apache/orc/impl/ZlibCodec.java:154–193  ·  view source on GitHub ↗
(ByteBuffer in, ByteBuffer out)

Source from the content-addressed store, hash-verified

152 }
153
154 @Override
155 public void decompress(ByteBuffer in, ByteBuffer out) throws IOException {
156
157 if(in.isDirect() && out.isDirect()) {
158 directDecompress(in, out);
159 return;
160 }
161
162 Inflater inflater = new Inflater(true);
163 try {
164 inflater.setInput(in.array(), in.arrayOffset() + in.position(),
165 in.remaining());
166 while (!(inflater.finished() || inflater.needsDictionary() ||
167 inflater.needsInput())) {
168 try {
169 int count = inflater.inflate(out.array(),
170 out.arrayOffset() + out.position(),
171 out.remaining());
172 out.position(count + out.position());
173
174 if (!inflater.finished() && !inflater.needsDictionary() && !inflater.needsInput() &&
175 count == 0) {
176 if (out.remaining() == 0) {
177 throw new IOException("Decompress output buffer too small. in = " + in +
178 ", out = " + out);
179 } else {
180 throw new IOException("Decompress error. in = " + in +
181 ", out = " + out);
182 }
183 }
184 } catch (DataFormatException dfe) {
185 throw new IOException("Bad compression data", dfe);
186 }
187 }
188 out.flip();
189 } finally {
190 inflater.end();
191 }
192 in.position(in.limit());
193 }
194
195 @Override
196 public boolean isAvailable() {

Callers 1

testCorruptMethod · 0.95

Calls 3

directDecompressMethod · 0.95
flipMethod · 0.80
endMethod · 0.65

Tested by 1

testCorruptMethod · 0.76