Package org.exbin.auxiliary.paged_data
Class PagedDataInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.exbin.auxiliary.paged_data.PagedDataInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,FinishableStream
,SeekableStream
@ParametersAreNonnullByDefault public class PagedDataInputStream extends java.io.InputStream implements SeekableStream, FinishableStream
Input stream for paged data.
-
-
Constructor Summary
Constructors Constructor Description PagedDataInputStream(PagedData data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
long
finish()
Reads remaining data and returns size of all data processed by this stream.long
getProcessedSize()
Returns size of data processed so far.long
getStreamSize()
Returns length of the stream.int
read()
int
read(byte[] output, int off, int len)
void
seek(long position)
Moves position in the stream to given position from the start of the stream.
-
-
-
Constructor Detail
-
PagedDataInputStream
public PagedDataInputStream(PagedData data)
-
-
Method Detail
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] output, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
seek
public void seek(long position) throws java.io.IOException
Description copied from interface:SeekableStream
Moves position in the stream to given position from the start of the stream.- Specified by:
seek
in interfaceSeekableStream
- Parameters:
position
- target position- Throws:
java.io.IOException
- if input/output error
-
finish
public long finish() throws java.io.IOException
Description copied from interface:FinishableStream
Reads remaining data and returns size of all data processed by this stream.- Specified by:
finish
in interfaceFinishableStream
- Returns:
- size of data in bytes
- Throws:
java.io.IOException
- if input/output error occurs
-
getProcessedSize
public long getProcessedSize()
Description copied from interface:FinishableStream
Returns size of data processed so far.- Specified by:
getProcessedSize
in interfaceFinishableStream
- Returns:
- size of data in bytes
-
getStreamSize
public long getStreamSize()
Description copied from interface:SeekableStream
Returns length of the stream.- Specified by:
getStreamSize
in interfaceSeekableStream
- Returns:
- length of the stream in bytes, -1 if unable to determine
-
-