com.buck.common.codec
Class CodecEncoder

java.lang.Object
  extended by com.buck.common.codec.CodecEncoder

public abstract class CodecEncoder
extends Object

An engine that can transform raw data, represented as a sequence of bytes, to a specific encoding, into a sequence of bytes.

Author:
Robert J. Buck

Constructor Summary
protected CodecEncoder(Codec codec)
          Initializes a new encoder.
 
Method Summary
 Codec codec()
          Returns the codec that created this encoder.
abstract  byte[] encode(byte[] bytes)
          Encodes raw data using the codec.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodecEncoder

protected CodecEncoder(Codec codec)
Initializes a new encoder.

Parameters:
codec - The codec for this encoder.
Method Detail

codec

public final Codec codec()
Returns the codec that created this encoder.

Returns:
This encoder's codec

encode

public abstract byte[] encode(byte[] bytes)
Encodes raw data using the codec.

Parameters:
bytes - the raw data
Returns:
the encoded byte array


Copyright © 2013. All Rights Reserved.