wt.wrmf.transport
Class SegmentedInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended bywt.wrmf.transport.SegmentedInputStream
All Implemented Interfaces:
Serializable

public class SegmentedInputStream
extends InputStream
implements Serializable

SegmentedInputStream devides an input stream into several segments, the size of each segment is specified in the constructor.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
private static String CLASSNAME
           
private  InputStream is
           
private  long[] localCount
           
private static String RESOURCE
           
private  boolean segmentDone
           
private  int segmentIndex
           
private  long[] size
           
private  long totalCount
           
private  int totalSegments
           
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
SegmentedInputStream(InputStream is, long length)
          Devide the input stream into 2 segments: the first one will be of length "length"; the second one will be the rest of the stream.
SegmentedInputStream(InputStream is, long[] sizeArray)
          Devide the input stream into (sizeArray.length+1) segments with length specified by sizeArray[].
 
Method Summary
 void close()
           
 InputStream getNextSegment()
          

Supported API: false
 InputStream getSelectedSegment(int index)
          The index begins at 0.
 int read()
          

Supported API: false
 int read(byte[] buf)
          

Supported API: false
 int read(byte[] buf, int off, int len)
          

Supported API: false
private  int read0(byte[] buf, int off, int len)
           
 long skip(long n)
          Skip exactly n bytes.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

is

private InputStream is

size

private long[] size

totalCount

private long totalCount

localCount

private long[] localCount

segmentIndex

private int segmentIndex

totalSegments

private int totalSegments

segmentDone

private boolean segmentDone
Constructor Detail

SegmentedInputStream

public SegmentedInputStream(InputStream is,
                            long length)
Devide the input stream into 2 segments: the first one will be of length "length"; the second one will be the rest of the stream.

Supported API: false

Parameters:
is -
length -

SegmentedInputStream

public SegmentedInputStream(InputStream is,
                            long[] sizeArray)
Devide the input stream into (sizeArray.length+1) segments with length specified by sizeArray[]. The last segment will be the rest (if any) of the stream.

Supported API: false

Parameters:
is -
sizeArray -
Method Detail

getNextSegment

public InputStream getNextSegment()
                           throws IOException


Supported API: false

Returns:
InputStream
Throws:
IOException

getSelectedSegment

public InputStream getSelectedSegment(int index)
                               throws IOException
The index begins at 0.

Supported API: false

Parameters:
index -
Returns:
InputStream
Throws:
IOException

read

public int read()
         throws IOException


Supported API: false

Returns:
int
Throws:
IOException

read

public int read(byte[] buf,
                int off,
                int len)
         throws IOException


Supported API: false

Parameters:
buf -
off -
len -
Returns:
int
Throws:
IOException

read

public int read(byte[] buf)
         throws IOException


Supported API: false

Parameters:
buf -
Returns:
int
Throws:
IOException

skip

public long skip(long n)
          throws IOException
Skip exactly n bytes. This may overwrite the skip() method implemented for the input stream as in the constructor.

Supported API: false

Parameters:
n -
Returns:
long
Throws:
IOException

read0

private int read0(byte[] buf,
                  int off,
                  int len)
           throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException