|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.magnos.data.store.AbstractStore
org.magnos.data.store.FileStore
public class FileStore
A store which has a file as its persisted medium. All reads and writes are made to the file immediately.
| Constructor Summary | |
|---|---|
FileStore(java.io.File file)
Instantiantes a new FileStore. |
|
FileStore(java.io.File file,
StoreAccess access,
int capacity)
Instantiates a new FileStore while opening it with the given access and setting it to the given capacity. |
|
FileStore(java.lang.String filename)
Instantiantes a new FileStore. |
|
FileStore(java.lang.String filename,
StoreAccess access,
int capacity)
Instantiates a new FileStore while opening it with the given access and setting it to the given capacity. |
|
| Method Summary | |
|---|---|
java.io.File |
getFile()
Returns the file the store is persisted to. |
java.io.RandomAccessFile |
getStream()
The stream used to perform operations on the file. |
protected void |
storeClose()
Should close the store. |
protected void |
storeDelete()
Deletes the medium to which the store has been persisting to. |
protected boolean |
storeExists()
Returns whether the store exists in its probable medium. |
protected void |
storeFlush()
Should flush the contents of the store from memory to a persisted medium if the implementation supports it. |
protected void |
storeGet(int location,
byte[] bytes,
int offset,
int length)
Gets data at the given location and stores it in the given byte array. |
protected void |
storeGet(int location,
java.nio.ByteBuffer buffer)
Gets data at the given location and stores it in the given ByteBuffer. |
protected void |
storeLoad()
Should load contents of the store into memory from a persisted medium if the implementation supports it. |
protected int |
storeOpen(StoreAccess access)
Should open the store and return the capacity. |
protected void |
storePut(int location,
byte[] bytes,
int offset,
int length)
Puts data at the given location from the given byte array. |
protected void |
storePut(int location,
java.nio.ByteBuffer buffer)
Puts data at the given location from the given ByteBuffer. |
protected int |
storeResize(int capacity)
Resizes the store to the given capacity. |
| Methods inherited from class org.magnos.data.store.AbstractStore |
|---|
capacity, capacity, close, create, delete, equals, exists, flush, get, get, get, get, getAccess, getName, hashCode, isAutoFlush, isAutoLoad, isAutoOpen, isClosed, isOpen, load, open, put, put, put, setAccess, setAutoFlush, setAutoLoad, setAutoOpen, toString, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FileStore(java.io.File file,
StoreAccess access,
int capacity)
file - The file to persist data to. If this file doesn't exist it will be
created when the store is opened, sized, or written to.access - The requested access to the store.capacity - The requested capacity of the store.
public FileStore(java.lang.String filename,
StoreAccess access,
int capacity)
filename - The file to persist data to. If this file doesn't exist it will be
created when the store is opened, sized, or written to.access - The requested access to the store.capacity - The requested capacity of the store.public FileStore(java.io.File file)
file - The file to persist data to. If this file doesn't exist it will be
created when the store is opened, sized, or written to.public FileStore(java.lang.String filename)
filename - The file to persist data to. If this file doesn't exist it will be
created when the store is opened, sized, or written to.| Method Detail |
|---|
public java.io.File getFile()
public java.io.RandomAccessFile getStream()
protected int storeOpen(StoreAccess access)
throws java.io.IOException
storeOpen in class AbstractStorejava.io.IOException - An error occurred opening the store with the given access.
protected void storeLoad()
throws java.io.IOException
storeLoad in class AbstractStorejava.io.IOException - An error occurred loading the store.
protected void storeFlush()
throws java.io.IOException
storeFlush in class AbstractStorejava.io.IOException - An error occurred flushing the store.
protected void storeClose()
throws java.io.IOException
storeClose in class AbstractStorejava.io.IOException - An error occurred closing the store.protected void storeDelete()
storeDelete in class AbstractStoreprotected boolean storeExists()
storeExists in class AbstractStore
protected int storeResize(int capacity)
throws java.io.IOException
storeResize in class AbstractStorecapacity - The new capacity of the store.
java.io.IOException - An error occured resizing the store.
protected void storeGet(int location,
byte[] bytes,
int offset,
int length)
throws java.io.IOException
storeGet in class AbstractStorelocation - The offset to get the data, in bytes, from the beginning of the store.bytes - The array of bytes to place the data in.offset - The offset in the byte array to place the data.length - The number of bytes to copy from the store and place in the array.
java.io.IOException - An error occurred reading from the store.
protected void storePut(int location,
byte[] bytes,
int offset,
int length)
throws java.io.IOException
storePut in class AbstractStorelocation - The offset to put the data, in bytes, from the beginning of the store.bytes - The array of bytes to take data from.offset - The offset in the byte array to take the data.length - The number of bytes to copy from the array and place in the store.
java.io.IOException - An error occurred writing to the store.
protected void storeGet(int location,
java.nio.ByteBuffer buffer)
throws java.io.IOException
storeGet in class AbstractStorelocation - The offset to get the data, in bytes, from the beginning of the store.buffer - The buffer to place the data in. The buffer will be filled with data
to its limit (so it has no remaining bytes).
java.io.IOException - An error occurred reading from the store.
protected void storePut(int location,
java.nio.ByteBuffer buffer)
throws java.io.IOException
storePut in class AbstractStorelocation - The offset to put the data, in bytes, from the beginning of the store.buffer - The buffer to take the data from. The buffer will be emptied of data
to its limit (so it has no remaining bytes).
java.io.IOException - An error occurred writing to the store.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||