Skip navigation links

Oracle Security Developer Tools Crypto Java API Reference
11g (11.1.1)

E10668-02


oracle.security.crypto.core
Class CoderInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by oracle.security.crypto.core.CoderInputStream

All Implemented Interfaces:
java.io.Closeable

public class CoderInputStream
extends java.io.FilterInputStream

An input stream that encodes or decodes data passing through it.

To specify the Coder object that is used by the input stream to encode or decode the data, use the setCoder() method.

After filling a buffer of block size, the Coder object is used to encode or decode the buffer. The setMode() method is used to specify encoding or decoding mode (the default mode is decode.)

An IOException is thrown if there is not enough data to fill the buffer.


Field Summary
protected  byte[] buf
          The buffer which stores the data.
protected  Coder coder
          The Coder used by this stream.
protected  int count
          The number of bytes in the buffer.
static int DECODE_MODE
          The DECODE mode.
static int ENCODE_MODE
          The ENCODE mode.
protected  int mode
          the current mode

 

Fields inherited from class java.io.FilterInputStream
in

 

Constructor Summary
CoderInputStream(java.io.InputStream is, Coder c)
          Create a new CoderInputStream with the buffer size equal to the Coder block size.

 

Method Summary
 int available()
          Return the number of bytes that can be read without blocking.
 Coder getCoder()
          Get the Coder used in this stream.
 int getMode()
          Get the current mode.
 int read()
          Read one byte of data.
 int read(byte[] b, int off, int len)
          Reads into an array of bytes.
 void setMode(int m)
          Set the mode of the stream.

 

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

 

Field Detail

DECODE_MODE

public static final int DECODE_MODE
The DECODE mode.
See Also:
Constant Field Values

ENCODE_MODE

public static final int ENCODE_MODE
The ENCODE mode.
See Also:
Constant Field Values

mode

protected int mode
the current mode

coder

protected Coder coder
The Coder used by this stream.

buf

protected byte[] buf
The buffer which stores the data.

count

protected int count
The number of bytes in the buffer.

Constructor Detail

CoderInputStream

public CoderInputStream(java.io.InputStream is,
                        Coder c)
Create a new CoderInputStream with the buffer size equal to the Coder block size.

Method Detail

getCoder

public Coder getCoder()
Get the Coder used in this stream.

getMode

public int getMode()
Get the current mode.

setMode

public void setMode(int m)
Set the mode of the stream.

read

public int read()
         throws java.io.IOException
Read one byte of data. Blocks if no data is available.
Overrides:
read in class java.io.FilterInputStream
Returns:
the byte read, or -1 if end of stream reached.
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads into an array of bytes. Blocks if no data is available.
Overrides:
read in class java.io.FilterInputStream
Parameters:
b - the buffer which the data is read into
off - start offset of data
len - maximum number of bytes read
Returns:
the number of bytes read, or -1 if end of stream reached.
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Return the number of bytes that can be read without blocking.
Overrides:
available in class java.io.FilterInputStream
Throws:
java.io.IOException

Skip navigation links

Oracle Security Developer Tools Crypto Java API Reference
11g (11.1.1)

E10668-02


Copyright © 2005, 2009, Oracle. All rights reserved.