com.ibm.commons.util.io.base64
Class Base64InputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.ibm.commons.util.io.base64.Base64InputStream
All Implemented Interfaces:
java.io.Closeable
Direct Known Subclasses:
Base64.InputStream

public class Base64InputStream
extends java.io.FilterInputStream

A Base64 content transfer encoding filter stream.

From RFC 2045, section 6.8:

The Base64 Content-Transfer-Encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable. The encoding and decoding algorithms are simple, but the encoded data are consistently only about 33 percent larger than the unencoded data.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
Base64InputStream(java.io.InputStream in)
          Constructs an input stream that decodes an underlying Base64-encoded stream.
 
Method Summary
 int available()
          Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
 int read()
          Reads the next byte of data from the input stream.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from the input stream into an array of bytes.
 
Methods inherited from class java.io.FilterInputStream
close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64InputStream

public Base64InputStream(java.io.InputStream in)
Constructs an input stream that decodes an underlying Base64-encoded stream.

Parameters:
in - the Base64-encoded stream
Method Detail

read

public int read()
         throws java.io.IOException
Reads the next byte of data from the input stream.

Overrides:
read in class java.io.FilterInputStream
Returns:
next byte in data stream
Throws:
java.io.IOException - IO Exception occurred

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads up to len bytes of data from the input stream into an array of bytes.

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - buffer to put data
off - offset to start of buffer
len - number of bytes from buffer
Returns:
number of bytes read
Throws:
java.io.IOException - IO Exception occurred

available

public int available()
              throws java.io.IOException
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.

Overrides:
available in class java.io.FilterInputStream
Returns:
number of bytes that can be read
Throws:
java.io.IOException - IO Exception occurred