public class MappedBytes extends AbstractBytes<Void> implements net.openhft.chronicle.core.io.Closeable
bytesStore, isPresent, readPosition, writeLimit, writePosition
DEFAULT_BYTE_BUFFER_CAPACITY, MAX_BYTE_BUFFER_CAPACITY, MAX_CAPACITY
charToString
JAVA9_STRING_CODER_LATIN, JAVA9_STRING_CODER_UTF16
Modifier | Constructor and Description |
---|---|
protected |
MappedBytes(MappedFile mappedFile) |
protected |
MappedBytes(MappedFile mappedFile,
String name) |
Modifier and Type | Method and Description |
---|---|
Bytes<Void> |
append8bit(CharSequence cs,
int start,
int end)
Append a portion of a String to the Bytes in ISO-8859-1
|
Bytes<Void> |
appendUtf8(CharSequence cs,
int start,
int length) |
MappedBytesStore |
bytesStore() |
long |
capacity() |
Bytes<Void> |
clear()
Set the readPosition= writePosition = start, writeLimit = capacity
|
void |
close() |
BytesStore<Bytes<Void>,Void> |
copy() |
boolean |
isBackingFileReadOnly() |
boolean |
isClosed() |
boolean |
isElastic() |
static MappedBytes |
mappedBytes(File file,
long chunkSize) |
static MappedBytes |
mappedBytes(File file,
long chunkSize,
long overlapSize) |
static MappedBytes |
mappedBytes(File file,
long chunkSize,
long overlapSize,
boolean readOnly) |
static MappedBytes |
mappedBytes(MappedFile rw) |
static MappedBytes |
mappedBytes(String filename,
long chunkSize) |
MappedFile |
mappedFile() |
default void |
parse8bit(Appendable buffer,
StopCharsTester stopCharsTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default void |
parse8bit(Appendable buffer,
StopCharTester stopCharTester)
parse text with ISO-8859-1 decoding as character terminated.
|
default BigDecimal |
parseBigDecimal() |
default Boolean |
parseBoolean(StopCharTester tester)
Return true or false, or null if it could not be detected
as true or false.
|
default double |
parseDouble()
parse text as a double decimal.
|
default long |
parseLong()
parse text as a long integer.
|
default long |
parseLongDecimal()
Parse the significant digits of a decimal number.
|
default void |
parseUTF(Appendable buffer,
StopCharsTester stopCharsTester)
Deprecated.
|
default void |
parseUTF(Appendable buffer,
StopCharTester stopCharTester)
Deprecated.
|
default String |
parseUTF(StopCharTester stopCharTester)
Deprecated.
|
default void |
parseUtf8(Appendable buffer,
StopCharsTester stopCharsTester)
parse text with UTF-8 decoding as one or two character terminated.
|
default void |
parseUtf8(Appendable buffer,
StopCharTester stopCharTester)
parse text with UTF-8 decoding as character terminated.
|
default String |
parseUtf8(StopCharTester stopCharTester)
parse text with UTF-8 decoding as character terminated.
|
int |
peekVolatileInt() |
protected void |
performRelease() |
void |
rawCopy(BytesStore bytes,
long offset,
long length) |
protected void |
readCheckOffset(long offset,
long adding,
boolean given) |
default Reader |
reader()
Access these bytes as an ISO-8859-1 encoded Reader
|
static MappedBytes |
readOnly(File file) |
Bytes<Void> |
readPosition(long position) |
Bytes<Void> |
readPositionRemaining(long position,
long remaining) |
byte |
readVolatileByte(long offset)
Read a 8-bit byte from memory with a load barrier.
|
int |
readVolatileInt(long offset)
Read a 32-bit int from memory with a load barrier.
|
long |
readVolatileLong(long offset)
Read a 64-bit long from memory with a load barrier.
|
short |
readVolatileShort(long offset)
Read a 16-bit short from memory with a load barrier.
|
long |
realCapacity() |
void |
setNewChunkListener(NewChunkListener listener) |
boolean |
sharedMemory() |
default boolean |
skipTo(StopCharTester tester)
Skip text until a terminating character is reached.
|
long |
start() |
MappedBytes |
withSizes(long chunkSize,
long overlapSize) |
MappedBytes |
write(BytesStore bytes)
Write all data or fail.
|
Bytes<Void> |
write(BytesStore bytes,
long offset,
long length)
Write all data or fail.
|
MappedBytes |
write8bit(CharSequence s,
int start,
int length) |
Bytes<Void> |
writeByte(byte i8) |
protected void |
writeCheckOffset(long offset,
long adding) |
Bytes<Void> |
writeOrderedInt(long offset,
int i)
Perform a non stalling write with a store barrier.
|
Bytes<Void> |
writePosition(long position) |
Bytes<Void> |
writeUtf8(String s) |
addressForRead, addressForWrite, clearAndPad, compact, compareAndSwapInt, compareAndSwapLong, equals, equalsBytes, hashCode, isDirectMemory, isPresent, isPresent, lastDecimalPlaces, lastDecimalPlaces, move, nativeRead, nativeRead, nativeWrite, nativeWrite, peekUnsignedByte, peekUnsignedByte, prewrite, prewrite, prewriteByte, prewriteInt, prewriteLong, prewriteOffsetPositionMoved, prewriteShort, readByte, readByte, readDouble, readDouble, readFloat, readFloat, readInt, readInt, readLimit, readLimit, readLong, readLong, readOffsetPositionMoved, readPosition, readShort, readShort, readSkip, readUnsignedByte, readVolatileInt, readVolatileLong, refCount, release, reserve, toString, uncheckedReadSkipBackOne, uncheckedReadSkipOne, uncheckedReadUnsignedByte, underlyingObject, write, write, write, write, writeByte, writeCheckOffset0, writeDouble, writeDouble, writeFloat, writeFloat, writeInt, writeInt, writeIntAdv, writeLimit, writeLimit, writeLong, writeLong, writeLongAdv, writeOffsetPositionMoved, writeOffsetPositionMoved, writeOrderedInt, writeOrderedLong, writeOrderedLong, writePosition, writeShort, writeShort, writeSkip, writeSome, writeVolatileByte, writeVolatileInt, writeVolatileLong, writeVolatileShort
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
closeQuietly, closeQuietly, notifyClosing
allocateDirect, allocateDirect, allocateElasticDirect, allocateElasticDirect, bytesForRead, copyTo, copyTo, elasticByteBuffer, elasticByteBuffer, elasticByteBuffer, elasticHeapByteBuffer, ensureCapacity, from, fromHexString, fromString, indexOf, indexOf, indexOf, indexOf, isClear, isEqual, readBigDecimal, readBigInteger, readWithLength, readWrite, safeLimit, toHexString, toHexString, toHexString, toString, toString, toString, unchecked, unchecked, unwrite, wrapForRead, wrapForRead, wrapForWrite, wrapForWrite
addAndGetByteNotAtomic, addAndGetDoubleNotAtomic, addAndGetFloatNotAtomic, addAndGetIntNotAtomic, addAndGetLongNotAtomic, addAndGetShortNotAtomic, addAndGetUnsignedByteNotAtomic, addAndGetUnsignedIntNotAtomic, addAndGetUnsignedShortNotAtomic, byteCheckSum, bytesForWrite, charAt, cipher, cipher, contentEquals, empty, endsWith, equalBytes, inside, isEmpty, length, longCheckSum, nativePointer, startsWith, startsWith, subSequence, to8bitString, toDebugString, toDebugString, wrap, wrap, wrap, writeMaxLong, zeroOut
addAndGetDouble, addAndGetFloat, addAndGetInt, addAndGetLong, compareUtf8, copyTo, copyTo, createCharToString, fastHash, findByte, parseLong, printable, read, readBoolean, readIncompleteLong, readUnsignedByte, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8Limited, readUtf8Limited, readVolatileDouble, readVolatileFloat, subBytes, toByteArray, toTemporaryDirectByteBuffer
append, append, write, write, writeBoolean, writeByte, writeInt24, writeOrderedDouble, writeOrderedFloat, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUtf8Limited, writeVolatileDouble, writeVolatileFloat
chars, codePoints
bytesMethodReader, bytesMethodReaderBuilder
inputStream, parseHexLong, parseUTF, parseUtf8, read, read, read, read, read8bit, read8bit, read8bit, read8bit, readBoolean, readEnum, readHistogram, readPositionUnlimited, readStopBit, readStopBitDecimal, readStopBitDouble, readUnsignedInt, readUnsignedInt24, readUnsignedShort, readUtf8, readUtf8, readUTFΔ, readUTFΔ, readWithLength, readWithLength, readWithLength0
bytesMethodWriter, bytesMethodWriterBuilder
append, append, append, append, append, append, append, append, append8bit, append8bit, appendBase, appendBase16, appendDateMillis, appendDecimal, appendTimeMillis, writer
appendUtf8, appendUtf8, appendUtf8, appendUtf8, appendUtf8, copyFrom, outputStream, write, write, write, write8bit, write8bit, write8bit, writeBigDecimal, writeBigInteger, writeBoolean, writeEnum, writeHistogram, writeInt24, writePositionRemaining, writeSome, writeStopBit, writeStopBit, writeStopBitDecimal, writeUnsignedByte, writeUnsignedInt, writeUnsignedShort, writeUtf8, writeUTFΔ, writeWithLength
prepend
comment, indent, retainsComments
protected MappedBytes(@NotNull MappedFile mappedFile) throws IllegalStateException
IllegalStateException
protected MappedBytes(@NotNull MappedFile mappedFile, String name) throws IllegalStateException
IllegalStateException
@NotNull public static MappedBytes mappedBytes(@NotNull String filename, long chunkSize) throws FileNotFoundException, IllegalStateException
@NotNull public static MappedBytes mappedBytes(@NotNull File file, long chunkSize) throws FileNotFoundException, IllegalStateException
@NotNull public static MappedBytes mappedBytes(@NotNull File file, long chunkSize, long overlapSize) throws FileNotFoundException, IllegalStateException
@NotNull public static MappedBytes mappedBytes(@NotNull File file, long chunkSize, long overlapSize, boolean readOnly) throws FileNotFoundException, IllegalStateException
@NotNull public static MappedBytes mappedBytes(@NotNull MappedFile rw)
@NotNull public static MappedBytes readOnly(@NotNull File file) throws FileNotFoundException
FileNotFoundException
public void setNewChunkListener(NewChunkListener listener)
@NotNull public MappedFile mappedFile()
@NotNull public MappedBytes withSizes(long chunkSize, long overlapSize)
public BytesStore<Bytes<Void>,Void> copy()
public long capacity()
capacity
in interface BytesStore<Bytes<Void>,Void>
capacity
in class AbstractBytes<Void>
public long realCapacity()
realCapacity
in interface Bytes<Void>
realCapacity
in interface BytesStore<Bytes<Void>,Void>
realCapacity
in interface RandomDataInput
realCapacity
in interface StreamingDataOutput<Bytes<Void>>
realCapacity
in class AbstractBytes<Void>
@NotNull public Bytes<Void> readPositionRemaining(long position, long remaining) throws BufferUnderflowException
readPositionRemaining
in interface StreamingDataInput<Bytes<Void>>
BufferUnderflowException
@NotNull public Bytes<Void> readPosition(long position) throws BufferUnderflowException
readPosition
in interface StreamingDataInput<Bytes<Void>>
readPosition
in class AbstractBytes<Void>
BufferUnderflowException
protected void readCheckOffset(long offset, long adding, boolean given) throws BufferUnderflowException
BufferUnderflowException
protected void writeCheckOffset(long offset, long adding) throws BufferOverflowException
BufferOverflowException
@Nullable public MappedBytesStore bytesStore()
bytesStore
in interface Bytes<Void>
bytesStore
in interface BytesStore<Bytes<Void>,Void>
bytesStore
in class AbstractBytes<Void>
public long start()
start
in class AbstractBytes<Void>
@NotNull public Bytes<Void> writePosition(long position) throws BufferOverflowException
writePosition
in interface StreamingDataOutput<Bytes<Void>>
writePosition
in class AbstractBytes<Void>
BufferOverflowException
@NotNull public Bytes<Void> clear()
StreamingCommon
clear
in interface Bytes<Void>
clear
in interface StreamingCommon<Bytes<Void>>
clear
in class AbstractBytes<Void>
@NotNull public Bytes<Void> writeByte(byte i8) throws BufferOverflowException
writeByte
in interface StreamingDataOutput<Bytes<Void>>
writeByte
in class AbstractBytes<Void>
BufferOverflowException
protected void performRelease() throws IllegalStateException
IllegalStateException
public boolean isElastic()
public boolean isBackingFileReadOnly()
@NotNull public Bytes<Void> write(@NotNull BytesStore bytes, long offset, long length) throws BufferUnderflowException, BufferOverflowException
StreamingDataOutput
write
in interface StreamingDataOutput<Bytes<Void>>
BufferUnderflowException
BufferOverflowException
public void rawCopy(@NotNull BytesStore bytes, long offset, long length) throws BufferOverflowException, BufferUnderflowException
@NotNull public Bytes<Void> append8bit(@NotNull CharSequence cs, int start, int end) throws IllegalArgumentException, BufferOverflowException, BufferUnderflowException, IndexOutOfBoundsException
ByteStringAppender
append8bit
in interface ByteStringAppender<Bytes<Void>>
cs
- to copystart
- index of the first char inclusiveend
- index of the last char exclusive.BufferOverflowException
- If the string as too large to write in the capacity availableBufferUnderflowException
- if the capacity of the underlying buffer was exceededIndexOutOfBoundsException
- if the start or the end are not valid for the CharSequenceIllegalArgumentException
@NotNull public Bytes<Void> writeUtf8(String s) throws BufferOverflowException
writeUtf8
in interface StreamingDataOutput<Bytes<Void>>
BufferOverflowException
@NotNull public MappedBytes write8bit(CharSequence s, int start, int length)
write8bit
in interface StreamingDataOutput<Bytes<Void>>
@NotNull public Bytes<Void> appendUtf8(CharSequence cs, int start, int length) throws BufferOverflowException, IllegalArgumentException
appendUtf8
in interface StreamingDataOutput<Bytes<Void>>
BufferOverflowException
IllegalArgumentException
public boolean sharedMemory()
sharedMemory
in interface Bytes<Void>
@NotNull public Bytes<Void> writeOrderedInt(long offset, int i) throws BufferOverflowException
RandomDataOutput
writeOrderedInt
in interface RandomDataOutput<Bytes<Void>>
writeOrderedInt
in class AbstractBytes<Void>
offset
- to write toi
- value to writeBufferOverflowException
- if the capacity was exceededpublic byte readVolatileByte(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileByte
in interface RandomDataInput
readVolatileByte
in class AbstractBytes<Void>
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic short readVolatileShort(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileShort
in interface RandomDataInput
readVolatileShort
in class AbstractBytes<Void>
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic int readVolatileInt(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileInt
in interface RandomDataInput
readVolatileInt
in class AbstractBytes<Void>
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic long readVolatileLong(long offset) throws BufferUnderflowException
RandomDataInput
readVolatileLong
in interface RandomDataInput
readVolatileLong
in class AbstractBytes<Void>
offset
- to readBufferUnderflowException
- if the offset is outside the limits of the Bytespublic int peekVolatileInt()
peekVolatileInt
in interface RandomDataInput
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public boolean isClosed()
@NotNull public MappedBytes write(@NotNull BytesStore bytes) throws BufferOverflowException
StreamingDataOutput
write
in interface StreamingDataOutput<Bytes<Void>>
BufferOverflowException
@NotNull public Reader reader()
@Nullable public Boolean parseBoolean(@NotNull StopCharTester tester)
false: f, false, n, no, 0
true: t, true, y, yes, 1
tester
- to detect the end of the text.@NotNull public String parseUtf8(@NotNull StopCharTester stopCharTester)
stopCharTester
- to check if the end has been reached.@NotNull @Deprecated public String parseUTF(@NotNull StopCharTester stopCharTester)
public void parseUtf8(@NotNull Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
@Deprecated public void parseUTF(@NotNull Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
BufferUnderflowException
public void parseUtf8(@NotNull Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
buffer
- to populatestopCharsTester
- to check if the end has been reached.BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
@Deprecated public void parseUTF(@NotNull Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException, net.openhft.chronicle.core.io.IORuntimeException
BufferUnderflowException
net.openhft.chronicle.core.io.IORuntimeException
public void parse8bit(Appendable buffer, @NotNull StopCharTester stopCharTester) throws BufferUnderflowException
buffer
- to populatestopCharTester
- to check if the end has been reached.BufferUnderflowException
public void parse8bit(Appendable buffer, @NotNull StopCharsTester stopCharsTester) throws BufferUnderflowException
buffer
- to populatestopCharsTester
- to check if the end has been reached.BufferUnderflowException
public long parseLong() throws BufferUnderflowException
BufferUnderflowException
public double parseDouble() throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
public long parseLongDecimal() throws BufferUnderflowException
The number of decimal places can be retrieved with lastDecimalPlaces()
BufferUnderflowException
public boolean skipTo(@NotNull StopCharTester tester)
tester
- to stop at@NotNull public BigDecimal parseBigDecimal()
Copyright © 2017. All rights reserved.