Class ByteOutput (3.19.4)
Stay organized with collections
Save and categorize content based on your preferences.
publicabstractclass ByteOutputAn output target for raw bytes. This interface provides semantics that support two types of writing:
Traditional write operations: (as defined by java.io.OutputStream) where the target method is responsible for either copying the data or completing the write before returning from the method call.
Lazy write operations: where the caller guarantees that it will never modify the provided buffer and it can therefore be considered immutable. The target method is free to maintain a reference to the buffer beyond the scope of the method call (e.g. until the write operation completes).
Inherited Members
Constructors
ByteOutput()
publicByteOutput()Methods
write(byte value)
publicabstractvoidwrite(bytevalue)Writes a single byte.
| Parameter | |
|---|---|
| Name | Description |
value |
byte the byte to be written |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
thrown if an error occurred while writing |
write(byte[] value, int offset, int length)
publicabstractvoidwrite(byte[]value,intoffset,intlength)Writes a sequence of bytes. The ByteOutput must copy value if it will not be
processed prior to the return of this method call, since value may be reused/altered by
the caller.
NOTE: This method MUST NOT modify the value. Doing so is a
programming error and will lead to data corruption which will be difficult to debug.
| Parameters | |
|---|---|
| Name | Description |
value |
byte[]the bytes to be written |
offset |
int the offset of the start of the writable range |
length |
int the number of bytes to write starting from |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
thrown if an error occurred while writing |
write(ByteBuffer value)
publicabstractvoidwrite(ByteBuffervalue)Writes a sequence of bytes. The ByteOutput must copy value if it will not be
processed prior to the return of this method call, since value may be reused/altered by
the caller.
NOTE: This method MUST NOT modify the value. Doing so is a
programming error and will lead to data corruption which will be difficult to debug.
| Parameter | |
|---|---|
| Name | Description |
value |
ByteBuffer the bytes to be written. Upon returning from this call, the |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
thrown if an error occurred while writing |
writeLazy(byte[] value, int offset, int length)
publicabstractvoidwriteLazy(byte[]value,intoffset,intlength)Writes a sequence of bytes. The ByteOutput is free to retain a reference to the value beyond the scope of this method call (e.g. write later) since it is considered immutable and is guaranteed not to change by the caller.
NOTE: This method MUST NOT modify the value. Doing so is a
programming error and will lead to data corruption which will be difficult to debug.
| Parameters | |
|---|---|
| Name | Description |
value |
byte[]the bytes to be written |
offset |
int the offset of the start of the writable range |
length |
int the number of bytes to write starting from |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
thrown if an error occurred while writing |
writeLazy(ByteBuffer value)
publicabstractvoidwriteLazy(ByteBuffervalue)Writes a sequence of bytes. The ByteOutput is free to retain a reference to the value beyond the scope of this method call (e.g. write later) since it is considered immutable and is guaranteed not to change by the caller.
NOTE: This method MUST NOT modify the value. Doing so is a
programming error and will lead to data corruption which will be difficult to debug.
| Parameter | |
|---|---|
| Name | Description |
value |
ByteBuffer the bytes to be written. Upon returning from this call, the |
| Exceptions | |
|---|---|
| Type | Description |
IOException |
thrown if an error occurred while writing |