@Immutable public final class FileByteRangeProvider extends java.lang.Object implements ResourceByteRangeProvider
ResourceByteRangeProvider
- the underlying
resource is a file. Unless the underlying file is changed externally, this can be considered to be an immutable
implementationResourceByteRangeProvider.Utilities
Constructor and Description |
---|
FileByteRangeProvider(java.io.File resourceFile)
Constructor for a FileByteRangeProvider
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getByteRange(long rangeStart,
java.io.File workingDirectory)
A method to obtain bytes in the inclusive range [start, endOfFile] as a file
|
java.io.File |
getByteRange(long rangeStart,
long rangeEnd,
java.io.File workingDirectory)
A method to obtain bytes in the inclusive range [start, end] as a file
|
byte[] |
getByteRangeAsBytes(long rangeStart,
long rangeEnd)
This method provides a way to obtain a byte range from the resource in-memory.
|
long |
getResourceSize()
A method that returns the size in bytes of the underlying resource, in this case a File
|
public FileByteRangeProvider(java.io.File resourceFile)
resourceFile
- whose data will be read by this data providerpublic long getResourceSize()
getResourceSize
in interface ResourceByteRangeProvider
public java.io.File getByteRange(long rangeStart, java.io.File workingDirectory) throws java.io.IOException
rangeStart
- zero indexed inclusive start offset; ranges from 0 through (resourceSize -1) both includedworkingDirectory
- the working directory where the output file is placedjava.io.IOException
- - any I/O related error will be exposed through an IOExceptionpublic java.io.File getByteRange(long rangeStart, long rangeEnd, java.io.File workingDirectory) throws java.io.IOException
getByteRange
in interface ResourceByteRangeProvider
rangeStart
- zero indexed inclusive start offset; range from [0, (resourceSize -1)] inclusiverangeEnd
- zero indexed inclusive end offset; range from [0, (resourceSize -1)] inclusiveworkingDirectory
- the working directory where the output file is placedjava.io.IOException
- - any I/O related error will be exposed through an IOExceptionpublic byte[] getByteRangeAsBytes(long rangeStart, long rangeEnd) throws java.io.IOException
rangeStart
- zero indexed inclusive start offset; ranges from 0 through (resourceSize -1) both includedrangeEnd
- zero indexed inclusive end offset; ranges from 0 through (resourceSize -1) both includedjava.io.IOException
- - any I/O related error will be exposed through an IOException