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
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractPersistentBuffer
(ProtectionLevel protectionLevel) -
Method Summary
Modifier and TypeMethodDescriptionbyte
get
(long position) Implemented as call toget(long, byte[], int, int)
.void
get
(long position, byte[] buff, int off, int len) Implemented as calls toPersistentBuffer.getSome(long, byte[], int, int)
.boolean
getBoolean
(long position) Implemented as call toget(long)
.getInputStream
(long position, long length) Implemented as calls toget(long)
andPersistentBuffer.getSome(long, byte[], int, int)
.int
getInt
(long position) Implemented as call toget(long, byte[], int, int)
.long
getLong
(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.void
put
(long position, byte value) Implemented as call toPersistentBuffer.put(long, byte[], int, int)
.void
putInt
(long position, int value) Implemented as call toPersistentBuffer.put(long, byte[], int, int)
.void
putLong
(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, wait
Methods 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:PersistentBuffer
Gets the protection level currently enforced by the buffer.- Specified by:
getProtectionLevel
in interfacePersistentBuffer
- See Also:
-
get
Implemented as calls toPersistentBuffer.getSome(long, byte[], int, int)
.- Specified by:
get
in interfacePersistentBuffer
- Throws:
IOException
- See Also:
-
getBoolean
Implemented as call toget(long)
.- Specified by:
getBoolean
in 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:
get
in interfacePersistentBuffer
- Throws:
IOException
- See Also:
-
getInt
Implemented as call toget(long, byte[], int, int)
.- Specified by:
getInt
in interfacePersistentBuffer
- Throws:
IOException
- See Also:
-
getLong
Implemented as call toget(long, byte[], int, int)
.- Specified by:
getLong
in 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:
put
in interfacePersistentBuffer
- Throws:
IOException
- See Also:
-
putInt
Implemented as call toPersistentBuffer.put(long, byte[], int, int)
.- Specified by:
putInt
in interfacePersistentBuffer
- Throws:
IOException
- See Also:
-
putLong
Implemented as call toPersistentBuffer.put(long, byte[], int, int)
.- Specified by:
putLong
in 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:
getInputStream
in 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:
getOutputStream
in interfacePersistentBuffer
- Throws:
IOException
BufferOverflowException
- See Also:
-