Agent System POND 1.0 (1.7.2000)

FIM.Util.Coder.Base64
Class Base64InputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--FIM.Util.Coder.Base64.Base64InputStream

public class Base64InputStream
extends FilterInputStream

An input stream which decodes a base64-encoded stream.

Version:
1.1, 12 Jan 1997
Author:
Glenn Vanderburg, Michael Sonntag (Corrections)

Field Summary
(package private)  int[] buf
          Buffer for decoded bytes that haven't been read
(package private)  int buffered
          Number of buffered bytes
(package private)  byte[] ebuf
          Buffer for encoded bytes
(package private)  boolean textfile
          if true this is based on a textfile and \r\n will be translated to \n
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
Base64InputStream(InputStream in)
          Constructs a new Base64InputStream initialized with the specified input stream.
Base64InputStream(InputStream in, boolean textfile)
          Constructs a new Base64InputStream initialized with the specified input stream, for a text file.
 
Method Summary
(package private) static void ()
           
protected  void fill_buffer()
          Fills buf with a new chunk of decoded data.
static void main(String[] args)
          Test for Base64InputStream.
 int peek()
          Returns the next byte which will be read.
 int read()
          Reads a byte of data.
 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.FilterInputStream
available, close, mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buf

int[] buf
Buffer for decoded bytes that haven't been read

buffered

int buffered
Number of buffered bytes

ebuf

byte[] ebuf
Buffer for encoded bytes

textfile

boolean textfile
if true this is based on a textfile and \r\n will be translated to \n
Constructor Detail

Base64InputStream

public Base64InputStream(InputStream in)
Constructs a new Base64InputStream initialized with the specified input stream.
Parameters:
in - the input stream

Base64InputStream

public Base64InputStream(InputStream in,
                         boolean textfile)
Constructs a new Base64InputStream initialized with the specified input stream, for a text file. If the parameter textfile is true, a \r is immediately followed by a \n, the \r will be filtered out.
Parameters:
in - the input stream
textfile - true if the file is a text file
Method Detail

static void ()

read

public int read()
         throws IOException
Reads a byte of data. The method will block if no input is available.
Returns:
the byte read, or -1 if the end of the stream is reached.
Throws:
IOException - if an I/O error has occurred.
Overrides:
read in class FilterInputStream

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 in 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).
Parameters:
b - the buffer into which the data is read
off - the start offset of the data
len - the maximum number of bytes to read
Returns:
the actual number of bytes read or -1 when the end of the stream is reached
Throws:
IOException - if an I/O error has occurred.
Overrides:
read in class FilterInputStream

skip

public long skip(long n)
          throws IOException
Skips bytes of input.
Parameters:
n - number of bytes to be skipped
Returns:
the actual number of bytes skipped
Throws:
IOException - if an I/O error has occurred.
Overrides:
skip in class FilterInputStream

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.

main

public static void main(String[] args)
Test for Base64InputStream.

Agent System POND 1.0 (1.7.2000)

Submit a bug

Copyright 2000 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.