Package io.roastedroot.zerofs
Class ZeroFsInputStream
- java.lang.Object
-
- java.io.InputStream
-
- io.roastedroot.zerofs.ZeroFsInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
final class ZeroFsInputStream extends java.io.InputStreamInputStreamfor reading from a file'sRegularFile.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) RegularFilefileprivate FileSystemStatefileSystemStateprivate booleanfinishedprivate longpos
-
Constructor Summary
Constructors Constructor Description ZeroFsInputStream(RegularFile file, FileSystemState fileSystemState)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()private voidcheckNotClosed()voidclose()private booleanisOpen()intread()intread(byte[] b)intread(byte[] b, int off, int len)private intreadInternal(byte[] b, int off, int len)private static intsaturatedCast(long value)longskip(long n)
-
-
-
Field Detail
-
file
RegularFile file
-
pos
private long pos
-
finished
private boolean finished
-
fileSystemState
private final FileSystemState fileSystemState
-
-
Constructor Detail
-
ZeroFsInputStream
public ZeroFsInputStream(RegularFile file, FileSystemState fileSystemState)
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
readInternal
private int readInternal(byte[] b, int off, int len) throws java.io.IOException- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
saturatedCast
private static int saturatedCast(long value)
-
available
public int available() throws java.io.IOException- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
checkNotClosed
private void checkNotClosed() throws java.io.IOException- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
isOpen
private boolean isOpen()
-
-