@NotThreadSafe public final class FileDataProvider extends java.lang.Object implements ByteProvider
ByteProvider
. The underlying input
sequence of bytes is sourced from a file. While this implementation could be enhanced to make it thread-safe, it is
difficult to envision an application scenario where an input stream could be shared meaningfully among multiple callersConstructor and Description |
---|
FileDataProvider(java.io.File file)
Instantiates a new FileDataProvider object
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes(int totalNumBytesToRead)
Getter for the raw bytes from the encapsulated resource in this case a file
|
void |
skipBytes(long totalNumBytesToSkip)
A method that lets the caller skip bytes in the encapsulated resource in this case a file
|
public FileDataProvider(java.io.File file)
file
- the input filepublic byte[] getBytes(int totalNumBytesToRead) throws java.io.IOException
getBytes
in interface ByteProvider
totalNumBytesToRead
- the total num bytes to read from current position in the filejava.io.IOException
- - any I/O related error will be exposed through an IOExceptionpublic void skipBytes(long totalNumBytesToSkip) throws java.io.IOException
skipBytes
in interface ByteProvider
totalNumBytesToSkip
- the total num bytes to skip from the current position in the filejava.io.IOException
- - any I/O related error will be exposed through an IOException