Package de.xima.fc.common.io
Class MarkableNullInputStream
- java.lang.Object
-
- java.io.InputStream
-
- de.xima.fc.common.io.MarkableNullInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class MarkableNullInputStream extends InputStream
AnInputStream
that is always empty and markable / resettable.InputStream.nullInputStream()
is not markable, this one is. Some use cases such as the ICU4J library require markable input streams.- Since:
- 8.3.0
- Author:
- XIMA Media GmbH
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
void
mark(int readLimit)
static InputStream
markableNullInputStream()
Gets a new instance of a markable null input stream.boolean
markSupported()
int
read()
int
read(byte[] b, int off, int len)
byte[]
readAllBytes()
int
readNBytes(byte[] b, int off, int len)
byte[]
readNBytes(int len)
void
reset()
long
skip(long n)
long
transferTo(OutputStream out)
-
Methods inherited from class java.io.InputStream
nullInputStream, read
-
-
-
-
Method Detail
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
mark
public void mark(int readLimit)
- Overrides:
mark
in classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
readAllBytes
public byte[] readAllBytes() throws IOException
- Overrides:
readAllBytes
in classInputStream
- Throws:
IOException
-
readNBytes
public int readNBytes(byte[] b, int off, int len) throws IOException
- Overrides:
readNBytes
in classInputStream
- Throws:
IOException
-
readNBytes
public byte[] readNBytes(int len) throws IOException
- Overrides:
readNBytes
in classInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
transferTo
public long transferTo(OutputStream out) throws IOException
- Overrides:
transferTo
in classInputStream
- Throws:
IOException
-
markableNullInputStream
public static InputStream markableNullInputStream()
Gets a new instance of a markable null input stream.- Returns:
- A new instance of a markable null input stream.
-
-