|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.deckfour.xes.nikefs2.NikeFS2RandomAccessStorageImpl
public class NikeFS2RandomAccessStorageImpl
Implements the Random Access Storage interface for using the NikeFS2 virtual file system transparently to the application and user. Effectively, this class implements a file abstraction, backed not by a real OS-level file, but a set of virtual blocks in the VFS.
| Nested Class Summary | |
|---|---|
protected class |
NikeFS2RandomAccessStorageImpl.FS2BlockInputStream
Internal support class implementing an input stream over a list of blocks, as implemented by the enclosing class |
protected class |
NikeFS2RandomAccessStorageImpl.FS2BlockOutputStream
Internal support class implementing an output stream over a list of blocks, as implemented by the enclosing class |
protected class |
NikeFS2RandomAccessStorageImpl.FS2DataInputStream
Internal support class implementing a data input stream with NikeFS2-block-safe UTF-8 string serialization. |
protected class |
NikeFS2RandomAccessStorageImpl.FS2DataOutputStream
Internal support class implementing a data output stream with NikeFS2-block-safe UTF-8 string serialization. |
| Field Summary | |
|---|---|
protected List<NikeFS2Block> |
blocks
List of blocks used to store data. |
protected NikeFS2RandomAccessStorageImpl.FS2DataInputStream |
dataInputStream
Data input stream, used to simplify reading of higher-level data types. |
protected NikeFS2RandomAccessStorageImpl.FS2DataOutputStream |
dataOutputStream
Data output stream, used to simplify writing of higher-level data types. |
protected long |
pointer
Current file pointer (in bytes from the start) within this virtual file. |
protected long |
size
Current size, in bytes, of this virtual file. |
protected NikeFS2VirtualFileSystem |
vfs
References the virtual file system for block provision. |
| Constructor Summary | |
|---|---|
NikeFS2RandomAccessStorageImpl(NikeFS2VirtualFileSystem virtualFileSystem)
Creates a new instance of this class. |
|
| Method Summary | |
|---|---|
protected void |
adjustSize()
Calling this method will adjust the size of this file, if it is no longer accurate. |
void |
close()
Closes the data storage container. |
NikeFS2RandomAccessStorage |
copy()
Creates a clone, or copy, of this storage, having the exact same contents and the file pointer reset to zero. |
long |
getFilePointer()
Returns the current file pointer of the storage container. |
long |
length()
Returns the length, or size, in number of bytes currently used by this instance. |
boolean |
readBoolean()
|
byte |
readByte()
|
char |
readChar()
|
double |
readDouble()
|
float |
readFloat()
|
void |
readFully(byte[] b)
|
void |
readFully(byte[] b,
int off,
int len)
|
int |
readInt()
|
String |
readLine()
Deprecated. |
long |
readLong()
|
short |
readShort()
|
int |
readUnsignedByte()
|
int |
readUnsignedShort()
|
String |
readUTF()
|
void |
seek(long pos)
Repositions the offset, or file pointer, at which the next read or write operation will occur. |
int |
skipBytes(int n)
Moves the offset, or file pointer, a specified number of bytes towards the end of the storage container. |
protected int |
translateToBlockNumber(long offset)
Translates a virtual file pointer address in this instance to the block number, where the data is actually stored. |
protected int |
translateToBlockOffset(long offset)
Translates a virtual file pointer address in this instance to the offset within the block, where the data is actually stored. |
void |
write(byte[] b)
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
void |
writeBoolean(boolean v)
|
void |
writeByte(int b)
|
void |
writeBytes(String str)
|
void |
writeChar(int c)
|
void |
writeChars(String str)
|
void |
writeDouble(double d)
|
void |
writeFloat(float f)
|
void |
writeInt(int i)
|
void |
writeLong(long l)
|
void |
writeShort(int s)
|
void |
writeUTF(String str)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected NikeFS2VirtualFileSystem vfs
protected List<NikeFS2Block> blocks
protected long size
protected long pointer
protected NikeFS2RandomAccessStorageImpl.FS2DataOutputStream dataOutputStream
protected NikeFS2RandomAccessStorageImpl.FS2DataInputStream dataInputStream
| Constructor Detail |
|---|
public NikeFS2RandomAccessStorageImpl(NikeFS2VirtualFileSystem virtualFileSystem)
virtualFileSystem - The virtual file system instance
this virtual file can allocate storage blocks from.| Method Detail |
|---|
protected void adjustSize()
protected int translateToBlockNumber(long offset)
offset - The virtual file pointer address,
in bytes from the beginning.
protected int translateToBlockOffset(long offset)
offset - The virtual file pointer address,
in bytes from the beginning.
public void close()
throws IOException
NikeFS2RandomAccessStorage
close in interface NikeFS2RandomAccessStorageIOException
public NikeFS2RandomAccessStorage copy()
throws IOException
NikeFS2RandomAccessStorage
copy in interface NikeFS2RandomAccessStorageIOException
public long getFilePointer()
throws IOException
NikeFS2RandomAccessStorage
getFilePointer in interface NikeFS2RandomAccessStorageIOException
public long length()
throws IOException
NikeFS2RandomAccessStorage
length in interface NikeFS2RandomAccessStorageIOException
public void seek(long pos)
throws IOException
NikeFS2RandomAccessStorage
seek in interface NikeFS2RandomAccessStoragepos - The offset in bytes, at which the next operation
will occur.
IOException
public int skipBytes(int n)
throws IOException
NikeFS2RandomAccessStorage
skipBytes in interface DataInputskipBytes in interface NikeFS2RandomAccessStorageIOException
public void write(int b)
throws IOException
write in interface DataOutputIOException
public void write(byte[] b)
throws IOException
write in interface DataOutputIOException
public void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputIOException
public void writeBoolean(boolean v)
throws IOException
writeBoolean in interface DataOutputIOException
public void writeByte(int b)
throws IOException
writeByte in interface DataOutputIOException
public void writeBytes(String str)
throws IOException
writeBytes in interface DataOutputIOException
public void writeChar(int c)
throws IOException
writeChar in interface DataOutputIOException
public void writeChars(String str)
throws IOException
writeChars in interface DataOutputIOException
public void writeDouble(double d)
throws IOException
writeDouble in interface DataOutputIOException
public void writeFloat(float f)
throws IOException
writeFloat in interface DataOutputIOException
public void writeInt(int i)
throws IOException
writeInt in interface DataOutputIOException
public void writeLong(long l)
throws IOException
writeLong in interface DataOutputIOException
public void writeShort(int s)
throws IOException
writeShort in interface DataOutputIOException
public void writeUTF(String str)
throws IOException
writeUTF in interface DataOutputIOException
public boolean readBoolean()
throws IOException
readBoolean in interface DataInputIOException
public byte readByte()
throws IOException
readByte in interface DataInputIOException
public char readChar()
throws IOException
readChar in interface DataInputIOException
public double readDouble()
throws IOException
readDouble in interface DataInputIOException
public float readFloat()
throws IOException
readFloat in interface DataInputIOException
public void readFully(byte[] b)
throws IOException
readFully in interface DataInputIOException
public void readFully(byte[] b,
int off,
int len)
throws IOException
readFully in interface DataInputIOException
public int readInt()
throws IOException
readInt in interface DataInputIOException
@Deprecated
public String readLine()
throws IOException
readLine in interface DataInputIOException
public long readLong()
throws IOException
readLong in interface DataInputIOException
public short readShort()
throws IOException
readShort in interface DataInputIOException
public String readUTF()
throws IOException
readUTF in interface DataInputIOException
public int readUnsignedByte()
throws IOException
readUnsignedByte in interface DataInputIOException
public int readUnsignedShort()
throws IOException
readUnsignedShort in interface DataInputIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||