Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.io
Class Base64InputStream

    java.lang.Object
      java.io.InputStream
          com.novell.io.Base64InputStream

All Implemented Interfaces:
  Closeable

    public class Base64InputStream

extends InputStream

An extension of `java.io.InputStream` that decodes base64-encoded data from an InputStream.

See Also:
  `Base64OutputStream`

Constructor Summary
`Base64InputStream(InputStream in)` Constructs a new `Base64InputStream` that will read and decode from the passed `InputStream`.
`Base64InputStream(String str)` Constructs a new `Base64InputStream` that will read and decode the passed `String`.

Method Summary
`static byte[]` | `decode(char[] data)` Return an array of `byte`s which were encoded in the passed `char` array.
`static byte[]` | `decode(char[] data, int off, int len)` Return an array of `byte`s which were encoded in the passed `char` array.
`static byte[]` | `decode(String strData)` Return an array of `byte`s which were encoded in the passed `String`.
`protected void` | `fill_buffer()` Fills buf with a new chunk of decoded data.
`int` | `peek()` Returns the next byte which will be read.
`int` | `read()` Reads a byte of data (stripping whitespace).
`int` | `read(byte[] b, int off, int len)` Reads into an array of bytes.
`long` | `skip(long n)` Skips bytes of input.

Methods inherited from class java.io.InputStream
`available, close, mark, markSupported, read, reset`

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

Constructor Detail

### Base64InputStream

    public Base64InputStream(InputStream in)

  Constructs a new `Base64InputStream` that will read and decode from the passed `InputStream`.

  Parameters:
    `in` - the input stream

### Base64InputStream

    public Base64InputStream(String str)

  Constructs a new `Base64InputStream` that will read and decode the passed `String`.

  Parameters:
    `str` - The `String` to decode.

Method Detail

### read

    public int read()
             throws IOException

  Reads a byte of data (stripping whitespace). The method will block if no input is available.

  Specified by:
    `read` in class `InputStream`
  Returns:
    the byte read, or -1 if the end of the stream is reached.
  Throws:
    `IOException` - If an I/O error has occurred.

### peek

    public int peek()
             throws IOException

  Returns the next byte which will be read. The method will block if no input is available.

  Returns:
    the next byte to be read, or -1 if the end of the stream is reached.
  Throws:
    `IOException` - If an I/O error has occurred.

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws IOException

  Reads into an array of bytes. Blocks until some input is available. This method should be overridden in a subclass for efficiency (the default implementation reads 1 byte at a time).

  Overrides:
    `read` in class `InputStream`
  Parameters:
    `b` - the buffer into which the data is read
    `off` - the start offset of the data
    `len` - the maximum number of bytes read
  Returns:
    the actual number of bytes read, -1 is returned when the end of the stream is reached.
  Throws:
    `IOException` - If an I/O error has occurred.

### skip

    public long skip(long n)
              throws IOException

  Skips bytes of input.

  Overrides:
    `skip` in class `InputStream`
  Parameters:
    `n` - bytes to be skipped
  Returns:
    actual number of bytes skipped
  Throws:
    `IOException` - If an I/O error has occurred.

### fill_buffer

    protected void fill_buffer()
                        throws IOException

  Fills buf with a new chunk of decoded data.

  Throws:
    `IOException` - If an I/O error has occurred.

### decode

    public static byte[] decode(String strData)
                         throws IOException

  Return an array of `byte`s which were encoded in the passed `String`.

  Parameters:
    `strData` - the string of base64-encoded characters
  Returns:
    decoded `byte` array
  Throws:
    `IOException` - thrown if encoded data is malformed

### decode

    public static byte[] decode(char[] data)
                         throws IOException

  Return an array of `byte`s which were encoded in the passed `char` array.

  Parameters:
    `data` - the array of base64-encoded characters
  Returns:
    decoded `byte` array
  Throws:
    `IOException` - thrown if encoded data is malformed

### decode

    public static byte[] decode(char[] data,
                                int off,
                                int len)
                         throws IOException

  Return an array of `byte`s which were encoded in the passed `char` array.

  Parameters:
    `data` - the array of base64-encoded characters
    `off` - the starting offset in `data`
    `len` - the number of `char`s to decode from `data`
  Returns:
    decoded `byte` array
  Throws:
    `IOException` - thrown if encoded data is malformed

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD