TIFF Adobe ZIP support contributed by Jason Newton.
(byte[] input)
| 963 | |
| 964 | /** TIFF Adobe ZIP support contributed by Jason Newton. */ |
| 965 | public byte[] zipUncompress(byte[] input) { |
| 966 | ByteArrayOutputStream imageBuffer = new ByteArrayOutputStream(); |
| 967 | byte[] buffer = new byte[1024]; |
| 968 | Inflater decompressor = new Inflater(); |
| 969 | decompressor.setInput(input); |
| 970 | try { |
| 971 | while(!decompressor.finished()) { |
| 972 | int rlen = decompressor.inflate(buffer); |
| 973 | imageBuffer.write(buffer, 0, rlen); |
| 974 | } |
| 975 | } catch(Exception e){ |
| 976 | IJ.log(e.toString()); |
| 977 | } |
| 978 | decompressor.end(); |
| 979 | return imageBuffer.toByteArray(); |
| 980 | } |
| 981 | |
| 982 | /** |
| 983 | * Utility method for decoding an LZW-compressed image strip. |
no test coverage detected