iaik.smime
Class SharedByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by iaik.smime.SharedByteArrayInputStream
All Implemented Interfaces:
java.io.Closeable, javax.mail.internet.SharedInputStream

public class SharedByteArrayInputStream
extends java.io.ByteArrayInputStream
implements javax.mail.internet.SharedInputStream

SharedInputStream implementation based on a ByteArrayInputStream.


Field Summary
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
SharedByteArrayInputStream(byte[] buf)
          Creates a SharedByteArrayInputStream for reading data from the given byte array.
SharedByteArrayInputStream(byte[] buf, int offset, int length)
          Creates a SharedByteArrayInputStream for reading data from a sub-array of the given byte array.
 
Method Summary
 long getPosition()
          Gets the current postion of the stream as offset from the start postion.
 java.io.InputStream newStream(long start, long end)
          Gets a new SharedInputStream as substream from this InputStream.
 
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SharedByteArrayInputStream

public SharedByteArrayInputStream(byte[] buf)
Creates a SharedByteArrayInputStream for reading data from the given byte array.

Parameters:
buf - the data carrying byte array

SharedByteArrayInputStream

public SharedByteArrayInputStream(byte[] buf,
                                  int offset,
                                  int length)
Creates a SharedByteArrayInputStream for reading data from a sub-array of the given byte array.

Parameters:
buf - the data carrying byte array
offset - the position in the byte array from which to start reading
length - the maximum number of bytes that can be read
Method Detail

getPosition

public long getPosition()
Gets the current postion of the stream as offset from the start postion.

Specified by:
getPosition in interface javax.mail.internet.SharedInputStream
Returns:
the current read position in the stream

newStream

public java.io.InputStream newStream(long start,
                                     long end)
Gets a new SharedInputStream as substream from this InputStream.

Specified by:
newStream in interface javax.mail.internet.SharedInputStream
Parameters:
start - the start position in the current stream
end - the end position (+1) in the current stream; -1 if the new stream shall end at the same position as this stream
Returns:
the new stream sub stream

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

IAIK-CMS 6.0, (c) 2002 IAIK, (c) 2003, 2023 SIC