public final class WriteBuffers extends Object implements ByteStream.RandomAccessOutput
Modifier and Type | Class and Description |
---|---|
static class |
WriteBuffers.ByteSegmentRef
The class representing a segment of bytes in the buffer.
|
static class |
WriteBuffers.Position |
Constructor and Description |
---|
WriteBuffers(int wbSize,
long maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
getByteSegmentRefToCurrent(WriteBuffers.ByteSegmentRef byteSegmentRef,
int length,
WriteBuffers.Position readPos) |
int |
getLength() |
long |
getReadPoint(WriteBuffers.Position readPos) |
long |
getUnsafeReadPoint()
THIS METHOD IS NOT THREAD-SAFE.
|
WriteBuffers.Position |
getUnsafeReadPosition()
THIS METHOD IS NOT THREAD-SAFE.
|
long |
getWritePoint() |
int |
hashCode(byte[] key,
int offset,
int length) |
int |
hashCode(long offset,
int length,
WriteBuffers.Position readPos) |
boolean |
isEqual(byte[] left,
int leftOffset,
int leftLength,
long rightOffset,
int rightLength)
Compares part of the buffer with a part of an external byte array.
|
boolean |
isEqual(byte[] left,
int leftLength,
long rightOffset,
int rightLength)
Compares part of the buffer with a part of an external byte array.
|
boolean |
isEqual(byte[] left,
int leftOffset,
WriteBuffers.Position readPos,
int length)
Compares the current readPosition of the buffer with the external byte array.
|
boolean |
isEqual(long leftOffset,
int leftLength,
long rightOffset,
int rightLength)
Compares two parts of the buffer with each other.
|
void |
populateValue(WriteBuffers.ByteSegmentRef value)
Changes the byte segment reference from being a reference to global buffer to
the one with a self-contained byte array.
|
int |
readInt(long offset) |
long |
readNByteLong(long offset,
int bytes,
WriteBuffers.Position readPos) |
int |
readVInt(WriteBuffers.Position readPos) |
long |
readVLong(WriteBuffers.Position readPos) |
void |
reserve(int byteCount) |
void |
seal() |
void |
setReadPoint(long offset,
WriteBuffers.Position readPos) |
void |
setUnsafeReadPoint(long offset)
THIS METHOD IS NOT THREAD-SAFE.
|
void |
setWritePoint(long offset) |
long |
size()
Write buffer size
|
void |
skipVLong(WriteBuffers.Position readPos) |
int |
unsafeHashCode(long offset,
int length)
THIS METHOD IS NOT THREAD-SAFE.
|
long |
unsafeReadNByteLong(long offset,
int bytes)
THIS METHOD IS NOT THREAD-SAFE.
|
int |
unsafeReadVInt()
THIS METHOD IS NOT THREAD-SAFE.
|
long |
unsafeReadVLong()
THIS METHOD IS NOT THREAD-SAFE.
|
void |
unsafeSkipVLong()
THIS METHOD IS NOT THREAD-SAFE.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeByte(long offset,
byte value) |
void |
writeBytes(long offset,
int length)
Reads some bytes from the buffer and writes them again at current write point.
|
void |
writeFiveByteULong(long offset,
long v) |
void |
writeInt(long offset,
int v) |
void |
writeVInt(int value) |
void |
writeVLong(long value) |
public int unsafeReadVInt()
public int readVInt(WriteBuffers.Position readPos)
public long unsafeReadVLong()
public long readVLong(WriteBuffers.Position readPos)
public void unsafeSkipVLong()
public void skipVLong(WriteBuffers.Position readPos)
public void setUnsafeReadPoint(long offset)
public void setReadPoint(long offset, WriteBuffers.Position readPos)
public int unsafeHashCode(long offset, int length)
public int hashCode(long offset, int length, WriteBuffers.Position readPos)
public int hashCode(byte[] key, int offset, int length)
public void reserve(int byteCount)
reserve
in interface ByteStream.RandomAccessOutput
public void setWritePoint(long offset)
public void write(int b)
write
in interface ByteStream.RandomAccessOutput
public void write(byte[] b)
write
in interface ByteStream.RandomAccessOutput
public void write(byte[] b, int off, int len)
write
in interface ByteStream.RandomAccessOutput
public int getLength()
getLength
in interface ByteStream.RandomAccessOutput
public boolean isEqual(long leftOffset, int leftLength, long rightOffset, int rightLength)
public boolean isEqual(byte[] left, int leftLength, long rightOffset, int rightLength)
public boolean isEqual(byte[] left, int leftOffset, int leftLength, long rightOffset, int rightLength)
public boolean isEqual(byte[] left, int leftOffset, WriteBuffers.Position readPos, int length)
public void clear()
public long getWritePoint()
public long getUnsafeReadPoint()
public long getReadPoint(WriteBuffers.Position readPos)
public void getByteSegmentRefToCurrent(WriteBuffers.ByteSegmentRef byteSegmentRef, int length, WriteBuffers.Position readPos)
public void writeVInt(int value)
public void writeVLong(long value)
public void writeBytes(long offset, int length)
public void populateValue(WriteBuffers.ByteSegmentRef value)
public void seal()
public long unsafeReadNByteLong(long offset, int bytes)
public long readNByteLong(long offset, int bytes, WriteBuffers.Position readPos)
public void writeFiveByteULong(long offset, long v)
public int readInt(long offset)
public void writeInt(long offset, int v)
writeInt
in interface ByteStream.RandomAccessOutput
public void writeByte(long offset, byte value)
writeByte
in interface ByteStream.RandomAccessOutput
public long size()
public WriteBuffers.Position getUnsafeReadPosition()
Copyright © 2016 The Apache Software Foundation. All rights reserved.