de.vc.io

## Class CompressingChunkCodec

- java.lang.Object
- - de.vc.io.ChunkCodec
  - - de.vc.io.CompressingChunkCodec

-     public class CompressingChunkCodec
      extends ChunkCodec

  Use this chunk-codec for compressing chunks.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompressingChunkCodec()` Creates a new compressing chunk codex.
    `CompressingChunkCodec(int minChunkSize, boolean optimize)` Creates a new compressing chunk codex.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `decode(byte[] bytes, int len)` Do overwrite this methode for decoding a chunk.
    `void` | `encode(byte[] bytes, int len)` Do overwrite this methode for encoding a chunk.

    - ### Methods inherited from class de.vc.io.ChunkCodec

      `writeDecoded, writeDecoded, writeEncoded, writeEncoded`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CompressingChunkCodec

          public CompressingChunkCodec()

      Creates a new compressing chunk codex. The minimum chunk size for compressing is 1024 bytes and optimize is enabled.

    - #### CompressingChunkCodec

          public CompressingChunkCodec(int minChunkSize,
                               boolean optimize)

      Creates a new compressing chunk codex.
      Parameters:
        `minChunkSize` - Only chunks with a length less greater or equal to minChunkSize are encoded.
        `optimize` - Write uncompress chunk if size of compressed chunk is greater then size of plain chunk.

  - ### Method Detail

    - #### encode

          public void encode(byte[] bytes,
                    int len)
                      throws java.io.IOException

      Description copied from class: `ChunkCodec`
      Do overwrite this methode for encoding a chunk. If you have encoded the chunk call writeEncoded() methods.
      Overrides:
        `encode` in class `ChunkCodec`
      Parameters:
        `bytes` - Bytes of chunk. Note to respect the len parameter.
        `len` - Length of chunk.
      Throws:
        `java.io.IOException`

    - #### decode

          public void decode(byte[] bytes,
                    int len)
                      throws java.io.IOException

      Description copied from class: `ChunkCodec`
      Do overwrite this methode for decoding a chunk. If you have decoded the chunk call writeDecoded() methods.
      Overrides:
        `decode` in class `ChunkCodec`
      Parameters:
        `bytes` - Bytes of chunk. Note to respect the len parameter.
        `len` - Length of chunk.
      Throws:
        `java.io.IOException`

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.