| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Compressor |
|
| 1.0;1 |
| 1 | /** | |
| 2 | * Distribution License: | |
| 3 | * JSword is free software; you can redistribute it and/or modify it under | |
| 4 | * the terms of the GNU Lesser General Public License, version 2.1 or later | |
| 5 | * as published by the Free Software Foundation. This program is distributed | |
| 6 | * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | |
| 7 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 8 | * See the GNU Lesser General Public License for more details. | |
| 9 | * | |
| 10 | * The License is available on the internet at: | |
| 11 | * http://www.gnu.org/copyleft/lgpl.html | |
| 12 | * or by writing to: | |
| 13 | * Free Software Foundation, Inc. | |
| 14 | * 59 Temple Place - Suite 330 | |
| 15 | * Boston, MA 02111-1307, USA | |
| 16 | * | |
| 17 | * © CrossWire Bible Society, 2007 - 2016 | |
| 18 | * | |
| 19 | */ | |
| 20 | package org.crosswire.common.compress; | |
| 21 | ||
| 22 | import java.io.ByteArrayOutputStream; | |
| 23 | import java.io.IOException; | |
| 24 | ||
| 25 | /** | |
| 26 | * A compressor provides the ability to compress and uncompress block text. | |
| 27 | * Implementing classes are expected to provide a way to supply the input. | |
| 28 | * | |
| 29 | * @see gnu.lgpl.License The GNU Lesser General Public License for details. | |
| 30 | * @author DM Smith | |
| 31 | */ | |
| 32 | public interface Compressor { | |
| 33 | /** | |
| 34 | * The size to read/write when unzipping a compressed byte array of unknown | |
| 35 | * size. | |
| 36 | */ | |
| 37 | int BUF_SIZE = 2048; | |
| 38 | ||
| 39 | /** | |
| 40 | * Compresses the input and provides the result. | |
| 41 | * | |
| 42 | * @return the compressed result | |
| 43 | * @throws IOException if an exception is encountered | |
| 44 | */ | |
| 45 | ByteArrayOutputStream compress() throws IOException; | |
| 46 | ||
| 47 | /** | |
| 48 | * Uncompresses the input and provides the result. | |
| 49 | * | |
| 50 | * @return the uncompressed result | |
| 51 | * @throws IOException if an exception is encountered | |
| 52 | */ | |
| 53 | ByteArrayOutputStream uncompress() throws IOException; | |
| 54 | ||
| 55 | /** | |
| 56 | * Uncompresses the input and provides the result. | |
| 57 | * | |
| 58 | * @param expectedLength | |
| 59 | * the size of the result buffer | |
| 60 | * @return the uncompressed result | |
| 61 | * @throws IOException if an exception is encountered | |
| 62 | */ | |
| 63 | ByteArrayOutputStream uncompress(int expectedLength) throws IOException; | |
| 64 | } |