public class RandomAccessDataFile extends java.lang.Object implements RandomAccessData
RandomAccessData implementation backed by a RandomAccessFile.RandomAccessData.ResourceAccess| 构造器和说明 |
|---|
RandomAccessDataFile(java.io.File file)
Create a new
RandomAccessDataFile backed by the specified file. |
RandomAccessDataFile(java.io.File file,
int concurrentReads)
Create a new
RandomAccessDataFile backed by the specified file. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close() |
java.io.File |
getFile()
Returns the underlying File.
|
java.io.InputStream |
getInputStream(RandomAccessData.ResourceAccess access)
Returns an
InputStream that can be used to read the underlying data. |
long |
getSize()
Returns the size of the data.
|
RandomAccessData |
getSubsection(long offset,
long length)
Returns a new
RandomAccessData for a specific subsection of this data. |
public RandomAccessDataFile(java.io.File file)
RandomAccessDataFile backed by the specified file.file - the underlying filejava.lang.IllegalArgumentException - if the file is null or does not existRandomAccessDataFile(File, int)public RandomAccessDataFile(java.io.File file,
int concurrentReads)
RandomAccessDataFile backed by the specified file.file - the underlying fileconcurrentReads - the maximum number of concurrent reads allowed on the
underlying file before blockingjava.lang.IllegalArgumentException - if the file is null or does not existRandomAccessDataFile(File)public java.io.File getFile()
public java.io.InputStream getInputStream(RandomAccessData.ResourceAccess access) throws java.io.IOException
RandomAccessDataInputStream that can be used to read the underlying data. The
caller is responsible close the underlying stream.getInputStream 在接口中 RandomAccessDataaccess - hint indicating how the underlying data should be accessedjava.io.IOException - if the stream cannot be openedpublic RandomAccessData getSubsection(long offset, long length)
RandomAccessDataRandomAccessData for a specific subsection of this data.getSubsection 在接口中 RandomAccessDataoffset - the offset of the subsectionlength - the length of the subsectionpublic long getSize()
RandomAccessDatagetSize 在接口中 RandomAccessDatapublic void close()
throws java.io.IOException
java.io.IOException