java.lang.Object
com.aoapps.persistence.AbstractPersistentBuffer
- All Implemented Interfaces:
PersistentBuffer,Closeable,AutoCloseable
- Direct Known Subclasses:
LargeMappedPersistentBuffer,MappedPersistentBuffer,RandomAccessFileBuffer,TwoCopyBarrierBuffer
Provides a base implementation of
PersistentBuffer in terms of
basic read/write methods. This class is not thread safe.- Author:
- AO Industries, Inc.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPersistentBuffer(ProtectionLevel protectionLevel) -
Method Summary
Modifier and TypeMethodDescriptionbyteget(long position) Implemented as call toget(long, byte[], int, int).voidget(long position, byte[] buff, int off, int len) Implemented as calls toPersistentBuffer.getSome(long, byte[], int, int).booleangetBoolean(long position) Implemented as call toget(long).getInputStream(long position, long length) Implemented as calls toget(long)andPersistentBuffer.getSome(long, byte[], int, int).intgetInt(long position) Implemented as call toget(long, byte[], int, int).longgetLong(long position) Implemented as call toget(long, byte[], int, int).getOutputStream(long position, long length) Implemented as calls toput(long, byte)andPersistentBuffer.put(long, byte[], int, int).Gets the protection level currently enforced by the buffer.voidput(long position, byte value) Implemented as call toPersistentBuffer.put(long, byte[], int, int).voidputInt(long position, int value) Implemented as call toPersistentBuffer.put(long, byte[], int, int).voidputLong(long position, long value) Implemented as call toPersistentBuffer.put(long, byte[], int, int).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.aoapps.persistence.PersistentBuffer
barrier, capacity, close, ensureZeros, getSome, isClosed, put, setCapacity
-
Field Details
-
protectionLevel
-
-
Constructor Details
-
AbstractPersistentBuffer
-
-
Method Details
-
getProtectionLevel
Description copied from interface:PersistentBufferGets the protection level currently enforced by the buffer.- Specified by:
getProtectionLevelin interfacePersistentBuffer- See Also:
-
get
Implemented as calls toPersistentBuffer.getSome(long, byte[], int, int).- Specified by:
getin interfacePersistentBuffer- Throws:
IOException- See Also:
-
getBoolean
Implemented as call toget(long).- Specified by:
getBooleanin interfacePersistentBuffer- Throws:
IOException- See Also:
-
get
Implemented as call toget(long, byte[], int, int). For performance reasons, it is strongly recommended to provide a more efficient implementation of this method.- Specified by:
getin interfacePersistentBuffer- Throws:
IOException- See Also:
-
getInt
Implemented as call toget(long, byte[], int, int).- Specified by:
getIntin interfacePersistentBuffer- Throws:
IOException- See Also:
-
getLong
Implemented as call toget(long, byte[], int, int).- Specified by:
getLongin interfacePersistentBuffer- Throws:
IOException- See Also:
-
put
Implemented as call toPersistentBuffer.put(long, byte[], int, int). For performance reasons, it is strongly recommended to provide a more efficient implementation of this method.- Specified by:
putin interfacePersistentBuffer- Throws:
IOException- See Also:
-
putInt
Implemented as call toPersistentBuffer.put(long, byte[], int, int).- Specified by:
putIntin interfacePersistentBuffer- Throws:
IOException- See Also:
-
putLong
Implemented as call toPersistentBuffer.put(long, byte[], int, int).- Specified by:
putLongin interfacePersistentBuffer- Throws:
IOException- See Also:
-
getInputStream
public InputStream getInputStream(long position, long length) throws IOException, BufferUnderflowException Implemented as calls toget(long)andPersistentBuffer.getSome(long, byte[], int, int).- Specified by:
getInputStreamin interfacePersistentBuffer- Throws:
BufferUnderflowException- on end of fileIOException- See Also:
-
getOutputStream
public OutputStream getOutputStream(long position, long length) throws IOException, BufferOverflowException Implemented as calls toput(long, byte)andPersistentBuffer.put(long, byte[], int, int).- Specified by:
getOutputStreamin interfacePersistentBuffer- Throws:
IOExceptionBufferOverflowException- See Also:
-
