|
4 | 4 | import javax.annotation.Nullable; |
5 | 5 | import java.io.ByteArrayOutputStream; |
6 | 6 | import java.io.IOException; |
7 | | -import java.io.InputStream; |
8 | 7 | import java.nio.ByteBuffer; |
9 | 8 | import java.nio.file.Path; |
10 | 9 | import java.nio.file.Paths; |
11 | 10 | import java.util.stream.Stream; |
12 | 11 |
|
13 | | -import org.apache.commons.compress.archivers.ArchiveEntry; |
| 12 | +import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; |
14 | 13 | import org.apache.commons.compress.archivers.zip.*; |
15 | 14 |
|
16 | 15 | import java.util.zip.CRC32; |
@@ -270,29 +269,4 @@ public StoreHandle resolve(String... keys) { |
270 | 269 | public String toString() { |
271 | 270 | return "BufferedZipStore(" + underlyingStore.toString() + ")"; |
272 | 271 | } |
273 | | - |
274 | | - static class ByteBufferBackedInputStream extends InputStream { |
275 | | - private final ByteBuffer buf; |
276 | | - |
277 | | - public ByteBufferBackedInputStream(ByteBuffer buf) { |
278 | | - this.buf = buf; |
279 | | - } |
280 | | - |
281 | | - @Override |
282 | | - public int read() { |
283 | | - return buf.hasRemaining() ? (buf.get() & 0xFF) : -1; |
284 | | - } |
285 | | - |
286 | | - @Override |
287 | | - public int read(byte[] bytes, int off, int len) { |
288 | | - if (!buf.hasRemaining()) { |
289 | | - return -1; |
290 | | - } |
291 | | - |
292 | | - int toRead = Math.min(len, buf.remaining()); |
293 | | - buf.get(bytes, off, toRead); |
294 | | - return toRead; |
295 | | - } |
296 | | - } |
297 | | - |
298 | 272 | } |
0 commit comments