edu.vt.middleware.crypt.util
Class AbstractEncodingConverter

java.lang.Object
  extended by edu.vt.middleware.crypt.util.AbstractEncodingConverter
All Implemented Interfaces:
Converter
Direct Known Subclasses:
Base64Converter, HexConverter

public abstract class AbstractEncodingConverter
extends Object
implements Converter

Abstract base class for all converters that perform encoding with a BC Encoder class.

Version:
$Revision: 3 $
Author:
Middleware Services

Constructor Summary
AbstractEncodingConverter()
           
 
Method Summary
 String fromBytes(byte[] input)
          Converts a byte array to a formatted/encoded string.
 String fromBytes(byte[] input, int offset, int length)
          Converts a byte array to a formatted/encoded string.
protected abstract  org.bouncycastle.util.encoders.Encoder getEncoder()
          Gets the encoder instance that does the work of byte-char/char-byte encoding.
 byte[] toBytes(String input)
          Converts a formatted/encoded string to raw bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEncodingConverter

public AbstractEncodingConverter()
Method Detail

fromBytes

public String fromBytes(byte[] input)
Converts a byte array to a formatted/encoded string.

Specified by:
fromBytes in interface Converter
Parameters:
input - Input bytes.
Returns:
Formatted/encoded string derived from input bytes.

fromBytes

public String fromBytes(byte[] input,
                        int offset,
                        int length)
Converts a byte array to a formatted/encoded string.

Specified by:
fromBytes in interface Converter
Parameters:
input - Input bytes.
offset - Offset into input bytes at which to begin processing.
length - Number of bytes of input data to process.
Returns:
Formatted/encoded string derived from input bytes.

toBytes

public byte[] toBytes(String input)
Converts a formatted/encoded string to raw bytes.

Specified by:
toBytes in interface Converter
Parameters:
input - Formatted/encoded input string.
Returns:
Byte array corresponding to input string.

getEncoder

protected abstract org.bouncycastle.util.encoders.Encoder getEncoder()
Gets the encoder instance that does the work of byte-char/char-byte encoding.

Returns:
Encoder instance.


Copyright © 2003-2011 Virginia Tech. All Rights Reserved.