|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.planx.xmlstore.koala.io.NodeFileSystemImpl<R>
public class NodeFileSystemImpl<R extends Locatable>
A NodeFileSystem that decorates an existing FileSystem
and associates an IOPolicy.
| Constructor Summary | |
|---|---|
NodeFileSystemImpl(FileSystem fs,
IOPolicy<R> policy)
The NodeFileSystem will use a NodeConverter for
converting nodes to and from byte representation. |
|
| Method Summary | |
|---|---|
Bound |
all()
Returns a locator encapsulating all data currently in this file system. |
Bound |
allocate()
(Optional) Returns a locator to a free write position that can hold an unspecified amount of bytes. |
Bound |
allocate(long size)
Returns a locator to a free write position that can hold size number of bytes. |
void |
clear()
Frees all data in this FileSystem. |
void |
clearModified()
Marks this file system as unmodified. |
void |
close()
Closes this file system and releases all resources. |
void |
free(Bound l)
Frees the space occupied by the specified Bound. |
PositionalData |
getData(Locator l)
Returns a PositionalData for reading and writing to the
FileSystem at the specified location. |
Bound |
getMeta()
Returns a locator to a special block of meta data. |
IOPolicy<R> |
getPolicy()
Returns the IOPolicy associated with this
NodeFileSystem. |
SourceId |
id()
Returns a SourceId identifying this FileSystem
in its present state. |
boolean |
isContained(Locator l)
Returns true if the specified Locator
originates from this FileSystem and is valid. |
boolean |
isModified()
Returns true if this file system has been modified since
it was created or since the last call to FileSystem.clearModified(). |
boolean |
isReadOnly()
Returns true if this file system is read-only. |
SystemNode |
load(Locator loc,
RelativeDualReference<Locator,R> ref)
Loads a node from the file system. |
SystemNode |
load(R ref)
Loads a node from the file system. |
Locator |
save(SystemNode node)
Saves at end of the file system by appending (i.e. allocating using allocate()). |
void |
setMeta(Bound b)
Sets the meta data pointer of this file system. |
void |
setReadOnly(boolean isReadOnly)
Sets the read-only status of this file system. |
long |
size()
Returns the size of this file system. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NodeFileSystemImpl(FileSystem fs,
IOPolicy<R> policy)
NodeFileSystem will use a NodeConverter for
converting nodes to and from byte representation.
| Method Detail |
|---|
public IOPolicy<R> getPolicy()
NodeFileSystemIOPolicy associated with this
NodeFileSystem.
getPolicy in interface NodeFileSystem<R extends Locatable>
public SystemNode load(R ref)
throws IOException
NodeFileSystem
load in interface Loader<R extends Locatable,SystemNode>load in interface NodeFileSystem<R extends Locatable>IOException
public SystemNode load(Locator loc,
RelativeDualReference<Locator,R> ref)
throws IOException
NodeFileSystem
load in interface NodeFileSystem<R extends Locatable>IOException
public Locator save(SystemNode node)
throws IOException
allocate()).
save in interface NodeFileSystem<R extends Locatable>IOException
public SourceId id()
throws IOException
FileSystemSourceId identifying this FileSystem
in its present state. The SourceId can change at any point
and is not necessarily equal to the SourceIds
returned by allocation method even though these may still be valid. Thus,
this SourceId should be regarded as a unique canonical
id that identifies only the present state of this FileSystem.
id in interface FileSystemIOException
public Bound allocate()
throws IOException
FileSystemUnsupportedOperationException if this is not supported.
allocate in interface FileSystemIOException - if an I/O error occurred.
public Bound allocate(long size)
throws IOException
FileSystemsize number of bytes.
allocate in interface FileSystemIOException - if an I/O error occurred or the specified amount of
bytes could not be allocated.
public Bound all()
throws IOException
FileSystem
all in interface FileSystemIOException - if an I/O error occurred.
public void free(Bound l)
throws IOException
FileSystemBound.
free in interface FileSystemIOException - if an I/O error occurred.
InvalidSourceIdException - if the file system identifier of
the locator is invalid.
OutOfBoundsException - if the locator is out of bounds.
public Bound getMeta()
throws IOException
FileSystemnull is returned.
getMeta in interface FileSystemIOException
public void setMeta(Bound b)
throws IOException
FileSystem
setMeta in interface FileSystemIOException
public void clear()
throws IOException
FileSystemFileSystem.
clear in interface FileSystemIOException
public PositionalData getData(Locator l)
throws IOException
FileSystemPositionalData for reading and writing to the
FileSystem at the specified location.
getData in interface FileSystemIOException - if an I/O error occurred.
InvalidSourceIdException - if the file system identifier of
the locator is invalid.
OutOfBoundsException - if the locator is out of bounds.
public long size()
throws IOException
FileSystem
size in interface FileSystemIOException - if an I/O error occurred.
public boolean isModified()
throws IOException
FileSystemtrue if this file system has been modified since
it was created or since the last call to FileSystem.clearModified().
isModified in interface FileSystemIOException
public void clearModified()
throws IOException
FileSystem
clearModified in interface FileSystemIOException
public boolean isReadOnly()
throws IOException
FileSystemtrue if this file system is read-only.
isReadOnly in interface FileSystemIOException
public void setReadOnly(boolean isReadOnly)
throws IOException
FileSystem
setReadOnly in interface FileSystemIOException
public void close()
throws IOException
FileSystem
close in interface FileSystemIOException - if an I/O error occurred.
public boolean isContained(Locator l)
throws IOException
FileSystemtrue if the specified Locator
originates from this FileSystem and is valid.
isContained in interface FileSystemIOExceptionpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||