Package org.infinispan.protostream.impl
Class TagWriterImpl.ByteArrayEncoder
java.lang.Object
org.infinispan.protostream.impl.TagWriterImpl.Encoder
org.infinispan.protostream.impl.TagWriterImpl.ByteArrayEncoder
- Direct Known Subclasses:
TagWriterImpl.HeapByteBufferEncoder
- Enclosing class:
TagWriterImpl
Writes to a user provided byte array.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidfillFromBuffer(ByteBuffer byteBuffer) Copies frombyteBufferbuffer to our internal buffer the maximum bytes allowed by the available space and the remaining bytes.protected final voidFlush the entire buffer to an output stream.protected final voidflushToStream(OutputStream out, int requiredSpace) Make room for the required space by flushing the entire buffer to stream if the available space is not enough.protected final int(package private) final voidwriteByte(byte value) (package private) final voidwriteBytes(byte[] value, int offset, int length) (package private) final voidwriteBytes(ByteBuffer value) (package private) final voidwriteFixed32(int value) (package private) final voidwriteFixed64(long value) (package private) final voidwriteVarint32(int value) (package private) final voidwriteVarint64(long value) Methods inherited from class org.infinispan.protostream.impl.TagWriterImpl.Encoder
flush, writeBoolField, writeFixed32Field, writeFixed64Field, writeLengthDelimitedField, writeUInt32Field, writeUInt64Field
-
Field Details
-
array
private final byte[] array -
offset
protected final int offset -
limit
protected final int limit -
pos
protected int pos
-
-
Constructor Details
-
ByteArrayEncoder
private ByteArrayEncoder(byte[] array, int offset, int length)
-
-
Method Details
-
remainingSpace
protected final int remainingSpace() -
flushToStream
Make room for the required space by flushing the entire buffer to stream if the available space is not enough.- Throws:
IOException
-
flushToStream
Flush the entire buffer to an output stream.- Throws:
IOException
-
fillFromBuffer
Copies frombyteBufferbuffer to our internal buffer the maximum bytes allowed by the available space and the remaining bytes. Multiple invocations preceded by aflushToStream(OutputStream)invocation are needed if thebyteBufferbuffer still has remaining bytes after this call. -
writeByte
- Specified by:
writeBytein classTagWriterImpl.Encoder- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin classTagWriterImpl.Encoder- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin classTagWriterImpl.Encoder- Throws:
IOException
-
writeVarint32
- Specified by:
writeVarint32in classTagWriterImpl.Encoder- Throws:
IOException
-
writeVarint64
- Specified by:
writeVarint64in classTagWriterImpl.Encoder- Throws:
IOException
-
writeFixed32
- Specified by:
writeFixed32in classTagWriterImpl.Encoder- Throws:
IOException
-
writeFixed64
- Specified by:
writeFixed64in classTagWriterImpl.Encoder- Throws:
IOException
-