All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class cryptix.mime.Base64InputStream

java.lang.Object
   |
   +----java.io.InputStream
           |
           +----java.io.FilterInputStream
                   |
                   +----cryptix.mime.Base64InputStream

public class Base64InputStream
extends FilterInputStream
This class implements a BASE64 Character stream encoder as specified in RFC1521, part of the MIME specification as published by the Internet Engineering Task Force (IETF).

Unlike other encoding schemes there is nothing in this encoding that indicates where a buffer starts or ends. In other words, the encoded text simply starts at the first line and ends with the last one.

Copyright © 1995-1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.8 $

Author:
FH, Raif S. Naffah
See Also:
Base64OutputStream, Base64

Constructor Index

 o Base64InputStream(InputStream)
Create a Base64InputStream with no checksum.
 o Base64InputStream(InputStream, boolean)
If check is true then look for and check a PGP-style checksum immediately after the base64 portion.
 o Base64InputStream(InputStream, Checksum, int)
Creates a Base64InputStream that uses the given checksum.

Method Index

 o available()
Returns the number of bytes that can be guaranteed to be read from this input stream without blocking.
 o close()
 o mark(int)
Does nothing, since this class does not support mark/reset.
 o markSupported()
Tests if this input stream supports the mark and reset methods of InputStream, which it does not.
 o read()
Parse input in fours, producing three bytes to outBuf.
 o read(byte[], int, int)
 o reset()
Always throws an IOException, since this class does not support mark/reset.
 o skip(long)
Skips over and discards n bytes of data from the input stream.

Constructors

 o Base64InputStream
 public Base64InputStream(InputStream is,
                          boolean check)
If check is true then look for and check a PGP-style checksum immediately after the base64 portion.

See Also:
PRZ24
 o Base64InputStream
 public Base64InputStream(InputStream is)
Create a Base64InputStream with no checksum.

 o Base64InputStream
 public Base64InputStream(InputStream is,
                          Checksum checksum,
                          int length)
Creates a Base64InputStream that uses the given checksum. The checksum will be length bytes long, where 0 <= length <= 8.

Methods

 o close
 public synchronized void close() throws IOException
Overrides:
close in class FilterInputStream
 o read
 public synchronized int read() throws IOException
Parse input in fours, producing three bytes to outBuf. Should only see whitespace or illegal characters on a quadruplet boundary.

When using a checksum, wait for a "=" as the first character of a quadruplet; read sufficient quadruplets for crcLength bytes, and compare with our crc. If the end of the stream is reached at a bad spot, throw EOFException.

If we get the first illegal character on a four byte boundary, return -1 (Java EOF convention). Iff the underlying input stream is an instanceof PushbackInputStream, the illegal character will be pushed back.

Overrides:
read in class FilterInputStream
See Also:
PushbackInputStream
 o read
 public synchronized int read(byte buffer[],
                              int offset,
                              int length) throws IOException
Overrides:
read in class FilterInputStream
 o skip
 public synchronized long skip(long n) throws IOException
Skips over and discards n bytes of data from the input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

Parameters:
n - the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Throws: IOException
if an I/O error occurs.
Overrides:
skip in class FilterInputStream
 o available
 public synchronized int available() throws IOException
Returns the number of bytes that can be guaranteed to be read from this input stream without blocking. For a Base64InputStream, this is sometimes 0 even when data is available, because we do not read ahead far enough to determine whether the next character is the start of the checksum.

Throws: IOException
if an I/O error occurs.
Overrides:
available in class FilterInputStream
 o mark
 public void mark(int readlimit)
Does nothing, since this class does not support mark/reset.

Overrides:
mark in class FilterInputStream
 o reset
 public void reset() throws IOException
Always throws an IOException, since this class does not support mark/reset.

Overrides:
reset in class FilterInputStream
 o markSupported
 public boolean markSupported()
Tests if this input stream supports the mark and reset methods of InputStream, which it does not.

Returns:
false, since this class does not support the mark and reset methods.
Overrides:
markSupported in class FilterInputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index