org.ozoneDB.core.storage.gammaStore
Class RandomAccessFileStorage
java.lang.Object
org.ozoneDB.core.storage.gammaStore.AbstractStorage
org.ozoneDB.core.storage.gammaStore.RandomAccessFileStorage
- All Implemented Interfaces:
- Storage
- public class RandomAccessFileStorage
- extends AbstractStorage
- Version:
- $Id $
- Author:
- Leo Mekenkamp (mind the anti sp@m)
Field Summary |
private java.io.RandomAccessFile |
raFile
|
Method Summary |
void |
close()
|
long |
length()
|
void |
readFully(byte[] b,
int offset,
int length)
Read lenght bytes from b , starting at
offset . |
int |
readInt()
|
long |
readLong()
|
void |
seek(long pos)
Introduced because some implementing classes (based on FileOutputStream
and FileInputStream for instance) might not support seek
operations. |
void |
setLength(long length)
Sets the maximum length. |
void |
write(byte[] b,
int offset,
int length)
Write lenght bytes from b , starting at
offset . |
void |
writeInt(int value)
|
void |
writeLong(long value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
raFile
private java.io.RandomAccessFile raFile
RandomAccessFileStorage
RandomAccessFileStorage(java.io.File file,
java.lang.String mode)
throws java.io.IOException
setLength
public void setLength(long length)
throws java.io.IOException
- Description copied from interface:
Storage
- Sets the maximum length.
- Throws:
java.io.IOException
seek
public void seek(long pos)
throws java.io.IOException
- Description copied from interface:
Storage
Introduced because some implementing classes (based on FileOutputStream
and FileInputStream
for instance) might not support seek
operations. They may throw an UnsupportedOperationException
here, but still support writing and reading.
Implementations of this interface are used in 2 different ways: the
IndexManager
does not perform any seek actions, and thus the
storage implementation it uses can include stream based ones; the
ClusterManager
however does perform seek actions and thus
cannot have a storage implementation with streams in it.
- Throws:
java.io.IOException
readFully
public void readFully(byte[] b,
int offset,
int length)
throws java.io.IOException
- Description copied from interface:
Storage
- Read
lenght
bytes from b
, starting at
offset
.
- Throws:
java.io.IOException
write
public void write(byte[] b,
int offset,
int length)
throws java.io.IOException
- Description copied from interface:
Storage
- Write
lenght
bytes from b
, starting at
offset
.
- Throws:
java.io.IOException
readLong
public long readLong()
throws java.io.IOException
- Throws:
java.io.IOException
writeLong
public void writeLong(long value)
throws java.io.IOException
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
length
public long length()
throws java.io.IOException
- Throws:
java.io.IOException
readInt
public int readInt()
throws java.io.IOException
- Throws:
java.io.IOException
writeInt
public void writeInt(int value)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.