Package com.helger.base.codec.impl
Class LZWCodec
java.lang.Object
com.helger.base.codec.impl.LZWCodec
- All Implemented Interfaces:
IByteArrayCodec,IByteArrayDecoder,IByteArrayEncoder,IByteArrayStreamDecoder,IByteArrayStreamEncoder,ICodec<byte[]>,IDecoder<byte[],,byte[]> IEncoder<byte[],byte[]>
Encoder and decoder for the LZW algorithm
- Author:
- Philip Helger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classprotected static classprotected static classA single LZW node -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecode(byte @Nullable [] aEncodedBuffer, int nOfs, int nLen, @NonNull OutputStream aOS) Decode the passed LZW compressed buffer and write the decoded bytes to the output stream.voiddecode(@NonNull InputStream aEncodedIS, @NonNull OutputStream aOS) Decode LZW compressed data from the input stream and write the decoded bytes to the output stream.voidencode(byte @Nullable [] aBuffer, int nOfs, int nLen, @NonNull OutputStream aOS) Encode the passed buffer using LZW compression and write it to the output stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.base.codec.IByteArrayDecoder
getDecoded, getDecoded, getMaximumDecodedLengthMethods inherited from interface com.helger.base.codec.IByteArrayStreamDecoder
decode, getDecoded, getDecodedAsString, getDecodedAsString, getDecodedAsString, getDecodedAsStringMethods inherited from interface com.helger.base.codec.IByteArrayStreamEncoder
encode, getEncoded, getEncoded, getEncoded, getEncodedAsString, getEncodedAsString, getEncodedAsString, getMaximumEncodedLength
-
Constructor Details
-
LZWCodec
public LZWCodec()Constructor.
-
-
Method Details
-
encode
public void encode(byte @Nullable [] aBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @WillNotClose @NonNull OutputStream aOS) Encode the passed buffer using LZW compression and write it to the output stream.- Specified by:
encodein interfaceIByteArrayStreamEncoder- Parameters:
aBuffer- The buffer to be encoded. May benull.nOfs- The offset in the buffer to start encoding from.nLen- The number of bytes to encode.aOS- The output stream to write the encoded data to. May not benull.
-
decode
public void decode(@WillNotClose @NonNull InputStream aEncodedIS, @WillNotClose @NonNull OutputStream aOS) Decode LZW compressed data from the input stream and write the decoded bytes to the output stream.- Parameters:
aEncodedIS- The LZW encoded input stream to read from. May not benull.aOS- The output stream to write the decoded data to. May not benull.
-
decode
public void decode(byte @Nullable [] aEncodedBuffer, @Nonnegative int nOfs, @Nonnegative int nLen, @WillNotClose @NonNull OutputStream aOS) Decode the passed LZW compressed buffer and write the decoded bytes to the output stream.- Specified by:
decodein interfaceIByteArrayStreamDecoder- Parameters:
aEncodedBuffer- The LZW compressed buffer to be decoded. May benull.nOfs- The offset in the buffer to start decoding from.nLen- The number of bytes to decode.aOS- The output stream to write the decoded data to. May not benull.
-