Oracle Security Developer Tools Crypto Java API Reference
10g (10.1.4.0.1)

B28171-01


oracle.security.crypto.core
Class Coder

java.lang.Object
  extended byoracle.security.crypto.core.Coder

Direct Known Subclasses:
Cipher

public abstract class Coder
extends java.lang.Object

An abstract class that represents an encoding and decoding function, suitable for operations such as encryption and decryption, or compression and decompression.

A Coder object consists of two operations: An encoding operation, which transforms byte sequences into other byte sequences, and a corresponding decoding operation, which is the inverse of the encoding operation.

A Coder has a block size, which is the smallest length of a sequence which can be encoded or decoded. The length of any data which is input to the coder for encoding or decoding must be a multiple of the block size.

This is an abstract class. The following methods need to be implemented in a subclass:


Constructor Summary
protected Coder()
           

 

Method Summary
abstract  java.lang.String algName()
          Returns the name of the algorithm which this coder implements.
abstract  int blockSize()
          Deprecated. Use getBlockSize() instead.
 byte[] decode(byte[] bytes)
          Decodes an entire array of bytes.
 byte[] decode(byte[] bytes, int offset, int length)
          Decode an array of bytes, with the specified offset and number of bytes.
abstract  byte[] decodeOp(byte[] bytes)
          Decodes an array whose length is exactly equal to the block size.
 byte[] encode(byte[] bytes)
          Encode an entire array of bytes.
 byte[] encode(byte[] bytes, int offset, int length)
          Encode array of bytes, with the specified offset and number of bytes.
abstract  byte[] encodeOp(byte[] bytes)
          Encode an array which is exactly blockSize length.
abstract  int getBlockSize()
          Returns the block size of the coder.
 void initialize()
          Deprecated. This method has no effect, and all usages of it may be removed without problems.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Coder

protected Coder()

Method Detail

blockSize

public abstract int blockSize()
Deprecated. Use getBlockSize() instead.
Returns the block size of the coder.

getBlockSize

public abstract int getBlockSize()
Returns the block size of the coder.

encode

public byte[] encode(byte[] bytes,
                     int offset,
                     int length)
              throws CoderException
Encode array of bytes, with the specified offset and number of bytes.
Parameters:
bytes - bytes to be encoded
Returns:
the encoded bytes
Throws:
CoderException - thrown if coder not initialized, block size incorrect, etc.

encode

public byte[] encode(byte[] bytes)
              throws CoderException
Encode an entire array of bytes.
Parameters:
bytes - bytes to be encoded
Returns:
the encoded bytes
Throws:
CoderException - thrown if coder not initialized, block size incorrect, etc.

encodeOp

public abstract byte[] encodeOp(byte[] bytes)
                         throws CoderException
Encode an array which is exactly blockSize length. Must be implemented by subclass.
Returns:
the encoded bytes
Throws:
CoderException - thrown if blockSize is wrong.

decode

public byte[] decode(byte[] bytes,
                     int offset,
                     int length)
              throws CoderException
Decode an array of bytes, with the specified offset and number of bytes.
Parameters:
bytes - bytes to be encoded
Returns:
the decoded bytes
Throws:
CoderException - thrown if coder not initialized, block size incorrect, etc.

decode

public byte[] decode(byte[] bytes)
              throws CoderException
Decodes an entire array of bytes.
Parameters:
bytes - data to be decoded
Returns:
the decoded bytes
Throws:
CoderException - if coder not initialized, data is not a multiple of the block size, etc.

decodeOp

public abstract byte[] decodeOp(byte[] bytes)
                         throws CoderException
Decodes an array whose length is exactly equal to the block size. Must be implemented by subclass.
Returns:
the decoded bytes
Throws:
CoderException - thrown if blockSize is wrong.

algName

public abstract java.lang.String algName()
Returns the name of the algorithm which this coder implements.

initialize

public void initialize()
Deprecated. This method has no effect, and all usages of it may be removed without problems.

Oracle Security Developer Tools Crypto Java API Reference
10g (10.1.4.0.1)

B28171-01


Copyright © 2005 ,2006 , Oracle. All rights reserved.