Package org.opendaylight.raft.spi
Class AbstractFileStreamSource
java.lang.Object
org.opendaylight.raft.spi.AbstractFileStreamSource
- All Implemented Interfaces:
SizedStreamSource
,StreamSource
- Direct Known Subclasses:
FileStreamSource
,TransientFileStreamSource
@NonNullByDefault
public abstract sealed class AbstractFileStreamSource
extends Object
implements SizedStreamSource
permits TransientFileStreamSource, FileStreamSource
A
SizedStreamSource
providing access to a slice of a regular file, similar to a ByteBuffer
.-
Method Summary
Modifier and TypeMethodDescriptionabstract Path
file()
Returns this source's file path.final long
limit()
Returns the limit.final InputStream
Open anInputStream
which is reasonably buffered for small accesses.final InputStream
Open anInputStream
.final long
position()
Returns the starting position.final long
size()
Returns the size of this data source, which is to say the number of bytes available for reading from the stream returned byStreamSource.openStream()
.final String
toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.opendaylight.raft.spi.SizedStreamSource
toSizedStreamSource
Methods inherited from interface org.opendaylight.raft.spi.StreamSource
openDataInput
-
Method Details
-
file
Returns this source's file path.- Returns:
- this source's file path
-
position
public final long position()Returns the starting position.- Returns:
- the starting position
-
limit
public final long limit()Returns the limit.- Returns:
- the limit
-
openStream
Description copied from interface:StreamSource
Open anInputStream
.- Specified by:
openStream
in interfaceStreamSource
- Returns:
- an InputStream
- Throws:
IOException
- if an I/O error occurs
-
openBufferedStream
Description copied from interface:StreamSource
Open anInputStream
which is reasonably buffered for small accesses. Default implementation defers toStreamSource.openStream()
.- Specified by:
openBufferedStream
in interfaceStreamSource
- Returns:
- an InputStream
- Throws:
IOException
- if an I/O error occurs
-
size
public final long size()Description copied from interface:SizedStreamSource
Returns the size of this data source, which is to say the number of bytes available for reading from the stream returned byStreamSource.openStream()
.- Specified by:
size
in interfaceSizedStreamSource
- Returns:
- the size of this data source
-
toString
-