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, writeUTF
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getLocation, reacquire, release, setFileCache
protected java.util.List<RandomAccessDirectoryItem> children
protected int bufferSize
public RandomAccessDirectory(java.lang.String location) throws java.io.IOException
java.io.IOException
public RandomAccessDirectory(java.lang.String location, int bufferSize) throws java.io.IOException
java.io.IOException
public RandomAccessDirectoryItem getFileAtPos(int pos)
pos
- public java.util.List<RandomAccessDirectoryItem> getFilesInPath(java.lang.String path) throws java.io.IOException
path
- java.io.IOException
protected void setFileToPos(long pos) throws java.io.IOException
pos
- java.io.IOException
public void close() throws java.io.IOException
RandomAccessFile
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface FileCacheable
close
in class RandomAccessFile
java.io.IOException
- if an I/O error occurrs.public long getLastModified()
FileCacheable
FileFactory
.getLastModified
in interface FileCacheable
getLastModified
in class RandomAccessFile
long
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()
RandomAccessFile
isDirectory
in class RandomAccessFile
public long length()
RandomAccessFile
length
in class RandomAccessFile
public long readToByteChannel(java.nio.channels.WritableByteChannel dest, long offset, long nbytes) throws java.io.IOException
RandomAccessFile
nbytes
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 RandomAccessFile
dest
- 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
RandomAccessFile
read_
in class RandomAccessFile
pos
- 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.DataOutput
write
in class RandomAccessFile
b
- write this bytepublic void writeBytes(byte[] b, int off, int len)
writeBytes
in class RandomAccessFile
b
- the array containing the data.off
- the offset in the array to the data.len
- the length of the data.