iaik.smime
Class CanonicalizeInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by iaik.smime.CanonicalizeInputStream
All Implemented Interfaces:
java.io.Closeable

public class CanonicalizeInputStream
extends java.io.FilterInputStream

Canonicalizes an input stream so that any line is finished by a CRFL (13, 10).


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CanonicalizeInputStream(LineInputStream in, java.lang.String boundary)
          Creates a new CanonicalizeInputStream for canonicalizing the given LineInputStream.
 
Method Summary
 int available()
          Returns the number of bytes that can be read without blocking.
 void close()
          Closes this input stream.
 void mark(int readlimit)
          Does nothing since mark/reset is not supported by this stream.
 boolean markSupported()
          Returns false since mark/reset is not supported by this input stream.
 int read()
          Reads the next byte.
 int read(byte[] b, int off, int len)
          Reads and canonicalizes up to len bytes in the given byte array.
 void reset()
          Throws an IOException since mark/reset is not supported by this stream.
 long skip(long n)
          Skips the given number of bytes.
 
Methods inherited from class java.io.FilterInputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanonicalizeInputStream

public CanonicalizeInputStream(LineInputStream in,
                               java.lang.String boundary)
Creates a new CanonicalizeInputStream for canonicalizing the given LineInputStream.

Parameters:
in - the input stream to be canonicalized
boundary - the MIME boundary
Method Detail

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads and canonicalizes up to len bytes in the given byte array.

Overrides:
read in class java.io.FilterInputStream
Parameters:
b - the byte array to which to read
off - the start offset
len - the number of bytes to read
Throws:
java.io.IOException - if a read error occurs

read

public int read()
         throws java.io.IOException
Reads the next byte.

Overrides:
read in class java.io.FilterInputStream
Returns:
the next byte, or -1 if no more byte is available because the end of the stream already has been reached
Throws:
java.io.IOException - if an I/O error occurs

skip

public long skip(long n)
          throws java.io.IOException
Skips the given number of bytes.

Overrides:
skip in class java.io.FilterInputStream
Parameters:
n - the number of bytes to be skipped
Returns:
the number of skipped bytes
Throws:
java.io.IOException - if an I/O error occurrs

available

public int available()
              throws java.io.IOException
Returns the number of bytes that can be read without blocking.

Overrides:
available in class java.io.FilterInputStream
Returns:
the number of bytes that can be read without blocking
Throws:
java.io.IOException - if an I/O related problem occurs

close

public void close()
           throws java.io.IOException
Closes this input stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterInputStream
Throws:
java.io.IOException - if an I/O error occurs when closing the stream.

mark

public void mark(int readlimit)
Does nothing since mark/reset is not supported by this stream.

Overrides:
mark in class java.io.FilterInputStream
Parameters:
readlimit - the read limit; ignored

reset

public void reset()
           throws java.io.IOException
Throws an IOException since mark/reset is not supported by this stream.

Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException - thrown in any case since mark/reset is not supported by this stream.

markSupported

public boolean markSupported()
Returns false since mark/reset is not supported by this input stream.

Overrides:
markSupported in class java.io.FilterInputStream
Returns:
false

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 5.1, (c) 2002 IAIK, (c) 2003 - 2010 SIC