Package org.aksw.iguana.commons.io
Class ByteArrayListInputStream
java.lang.Object
java.io.InputStream
org.aksw.iguana.commons.io.ByteArrayListInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
An InputStream that reads from a list of byte arrays.
-
Constructor Summary
ConstructorDescriptionByteArrayListInputStream
(List<byte[]> data) Creates a new ByteArrayListInputStream that reads from the given list of byte arrays. -
Method Summary
Modifier and TypeMethodDescriptionint
long
Returns the number of bytes available to read from the stream.void
close()
Returns the current buffer that is being read from.int
read()
int
read
(byte[] b, int off, int len) byte[]
int
readNBytes
(byte[] b, int off, int len) byte[]
readNBytes
(int len) long
skip
(long n) void
skipNBytes
(long n) Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, reset, transferTo
-
Constructor Details
-
ByteArrayListInputStream
Creates a new ByteArrayListInputStream that reads from the given list of byte arrays. The list is not copied, so it should not be modified while the stream is in use.- Parameters:
data
- the list of byte arrays to read from
-
-
Method Details
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
readAllBytes
- Overrides:
readAllBytes
in classInputStream
- Throws:
IOException
-
readNBytes
- Overrides:
readNBytes
in classInputStream
- Throws:
IOException
-
readNBytes
- Overrides:
readNBytes
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
skipNBytes
- Overrides:
skipNBytes
in classInputStream
- Throws:
IOException
-
available
public int available()- Overrides:
available
in classInputStream
-
availableLong
public long availableLong()Returns the number of bytes available to read from the stream.- Returns:
- the number of bytes available
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
getCurrentBuffer
Returns the current buffer that is being read from.- Returns:
- the current buffer
-