public class RandomAccessDirectory extends RandomAccessFile implements FileCacheable, java.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
RandomAccessDirectory.Provider
Hook into service provider interface to RandomAccessFileProvider.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
bufferSize |
protected java.util.List<RandomAccessDirectoryItem> |
children |
allFiles, BIG_ENDIAN, bigEndian, buffer, bufferModified, bufferStart, dataEnd, dataSize, debugAccess, debugLeaks, defaultBufferSize, endOfFile, file, fileChannel, filePosition, LITTLE_ENDIAN, location, openFiles, readonly, showOpen, showRead| Constructor and Description |
|---|
RandomAccessDirectory(java.lang.String location) |
RandomAccessDirectory(java.lang.String location,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the file, and release any associated system resources.
|
RandomAccessDirectoryItem |
getFileAtPos(int pos)
Return the directory item containing the specified position
|
java.util.List<RandomAccessDirectoryItem> |
getFilesInPath(java.lang.String path)
Find all files in the store that fall under the given path
|
long |
getLastModified()
Returns the time that the underlying file(s) were last modified.
|
boolean |
isDirectory()
Returns true if RandomAccessFile represents a directory structure
|
long |
length()
Get the length of the file.
|
protected int |
read_(long pos,
byte[] b,
int offset,
int len)
Read directly from file, without going through the buffer.
|
long |
readToByteChannel(java.nio.channels.WritableByteChannel dest,
long offset,
long nbytes)
Read
nbytes bytes, at the specified file offset, send to a WritableByteChannel. |
protected void |
setFileToPos(long pos)
sets current RandomAccessFile to that containing pos
saves start position on current RAF
|
void |
write(int b)
Not implemented - use write methods on the leaf RandomAccessFile
e.g.
|
void |
writeBytes(byte[] b,
int off,
int len)
Not implemented - use write methods on the leaf RandomAccessFile
e.g.
|
acquire, acquire, eject, enableDefaultGlobalFileCache, flush, getAllFiles, getBufferSize, getDebugLeaks, getDebugNbytes, getDebugNseeks, getFilePointer, getGlobalFileCache, getLocation, getMaxOpenFileCount, getOpenFileCount, getOpenFiles, getRandomAccessFile, isAtEndOfFile, order, order, reacquire, read, read, read, readBoolean, readBuffer, readByte, readBytes, readBytes, readChar, readDouble, readDouble, readFloat, readFloat, readFully, readFully, readInt, readInt, readIntUnbuffered, readLine, readLine, readLong, readLong, readShort, readShort, readString, readString, readStringMax, readStringMax, readUnsignedByte, readUnsignedShort, readUTF, release, searchForward, seek, setBufferSize, setDebugAccess, setDebugLeaks, setExtendMode, setFileCache, setGlobalFileCache, setMinLength, shutdown, skipBytes, skipBytes, toString, unread, write, write, writeBoolean, writeBoolean, writeByte, writeBytes, writeBytes, writeChar, writeChar, writeChar, writeChar, writeChar, writeChar, writeChars, writeChars, writeChars, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeInt, writeInt, writeInt, writeInt, writeInt, writeInt, writeLong, writeLong, writeLong, writeLong, writeLong, writeLong, writeShort, writeShort, writeShort, writeShort, writeShort, writeShort, writeUTFclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLocation, reacquire, release, setFileCacheprotected java.util.List<RandomAccessDirectoryItem> children
protected int bufferSize
public RandomAccessDirectory(java.lang.String location)
throws java.io.IOException
java.io.IOExceptionpublic RandomAccessDirectory(java.lang.String location,
int bufferSize)
throws java.io.IOException
java.io.IOExceptionpublic RandomAccessDirectoryItem getFileAtPos(int pos)
pos - public java.util.List<RandomAccessDirectoryItem> getFilesInPath(java.lang.String path) throws java.io.IOException
path - java.io.IOExceptionprotected void setFileToPos(long pos)
throws java.io.IOException
pos - java.io.IOExceptionpublic void close()
throws java.io.IOException
RandomAccessFileclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface FileCacheableclose in class RandomAccessFilejava.io.IOException - if an I/O error occurrs.public long getLastModified()
FileCacheableFileFactory.getLastModified in interface FileCacheablegetLastModified in class RandomAccessFilelong value representing the time the file(s) were last modified or 0L if the
last-modified time couldn't be determined for any reason.public boolean isDirectory()
RandomAccessFileisDirectory in class RandomAccessFilepublic long length()
RandomAccessFilelength in class RandomAccessFilepublic long readToByteChannel(java.nio.channels.WritableByteChannel dest,
long offset,
long nbytes)
throws java.io.IOException
RandomAccessFilenbytes bytes, at the specified file offset, send to a WritableByteChannel.
This will block until all bytes are read.
This uses the underlying file channel directly, bypassing all user buffers.readToByteChannel in class RandomAccessFiledest - write to this WritableByteChannel.offset - the offset in the file where copying will start.nbytes - the number of bytes to read.java.io.IOException - if an I/O error occurs.protected int read_(long pos,
byte[] b,
int offset,
int len)
throws java.io.IOException
RandomAccessFileread_ in class RandomAccessFilepos - start here in the fileb - put data into this bufferoffset - buffer offsetlen - this number of bytesjava.io.IOException - on io errorpublic void write(int b)
write in interface java.io.DataOutputwrite in class RandomAccessFileb - write this bytepublic void writeBytes(byte[] b,
int off,
int len)
writeBytes in class RandomAccessFileb - the array containing the data.off - the offset in the array to the data.len - the length of the data.