edu.vt.middleware.crypt.io
Class Base64FilterInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by edu.vt.middleware.crypt.io.AbstractEncodingFilterInputStream
              extended by edu.vt.middleware.crypt.io.Base64FilterInputStream
All Implemented Interfaces:
Closeable

public class Base64FilterInputStream
extends AbstractEncodingFilterInputStream

Converts an input stream of base-64 encoded character bytes into raw bytes.

Version:
$Revision: 3 $
Author:
Middleware Services

Field Summary
static int LINE_LENGTH_64
          Wrap lines at 64 characters.
static int LINE_LENGTH_76
          Wrap lines at 76 characters.
 
Fields inherited from class edu.vt.middleware.crypt.io.AbstractEncodingFilterInputStream
byteBuffer, CHUNK_SIZE, decodeBuffer, position
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
Base64FilterInputStream(InputStream in)
          Creates a base-64 filter input stream around the given input stream.
Base64FilterInputStream(InputStream in, int charsPerLine)
          Creates a base-64 filter input stream around the given input stream.
 
Method Summary
protected  void fillBuffer()
          Reads characters from the input reader and decodes them to fill AbstractEncodingFilterInputStream.decodeBuffer.
protected  int getDecodeBufferCapacity()
          Gets the encoder that decodes encoded character data in the input stream to raw bytes.
 
Methods inherited from class edu.vt.middleware.crypt.io.AbstractEncodingFilterInputStream
read, read, read
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_LENGTH_64

public static final int LINE_LENGTH_64
Wrap lines at 64 characters.

See Also:
Constant Field Values

LINE_LENGTH_76

public static final int LINE_LENGTH_76
Wrap lines at 76 characters.

See Also:
Constant Field Values
Constructor Detail

Base64FilterInputStream

public Base64FilterInputStream(InputStream in)
Creates a base-64 filter input stream around the given input stream.

Parameters:
in - Input stream to wrap.

Base64FilterInputStream

public Base64FilterInputStream(InputStream in,
                               int charsPerLine)
Creates a base-64 filter input stream around the given input stream.

Parameters:
in - Input stream to wrap.
charsPerLine - Number of characters per line of encoded input. Must be one of LINE_LENGTH_64, LINE_LENGTH_76, or 0 to indicate no wrapping.
Method Detail

getDecodeBufferCapacity

protected int getDecodeBufferCapacity()
Gets the encoder that decodes encoded character data in the input stream to raw bytes.

Specified by:
getDecodeBufferCapacity in class AbstractEncodingFilterInputStream
Returns:
Encoder instance.

fillBuffer

protected void fillBuffer()
                   throws IOException
Reads characters from the input reader and decodes them to fill AbstractEncodingFilterInputStream.decodeBuffer.

Specified by:
fillBuffer in class AbstractEncodingFilterInputStream
Throws:
IOException - On read errors.


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