public interface ByteOutflow
/!\ All array or String lengths are encoded as UInt32 to reflect their maximum possible length in JAVA.
- Author:
- Pierre Convert Copyright (C) 2022, Pierre Convert. All rights reserved.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault capacity for underlybing buffer. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidputBool8(boolean value) Hack for js partvoidputByte(byte b) Directly put bytevoidputByteArray(byte[] bytes) Write bytes array.voidputByteArray(byte[] array, int offset, int length) Put an array of bytes from an array from a given offset for a given length.voidputFlags8(boolean[] flags) Auto-feed underlying ByteBuffer as necessary.voidputFloat32(float value) Auto-feed underlying ByteBuffer as necessary.default voidputFloat32Array(float[] value) Write an float[] array into the flow.voidputFloat64(double value) Auto-feed underlying ByteBuffer as necessary.default voidputFloat64Array(double[] value) Write double[] value to the outflow.voidputInt16(short value) Auto-feed underlying ByteBuffer as necessary.voidputInt32(int value) Auto-feed underlying ByteBuffer as necessary.default voidputInt32Array(int[] value) Push an Int32[] array into the flow.voidputInt64(long value) Auto-feed underlying ByteBuffer as necessary.default voidputInt64Array(long[] value) Put value in thr flowvoidputInt8(byte value) Write value to the flow (Auto-feed underlying ByteBuffer as necessary).voidputStringUTF8(String str) String is encoded in UTF8.voidputUInt16(int value) Auto-feed underlying ByteBuffer as necessary.voidputUInt24(int value) Auto-feed underlying ByteBuffer as necessary.voidputUInt31(int value) Auto-feed underlying ByteBuffer as necessary.voidputUInt32(long value) Auto-feed underlying ByteBuffer as necessary.voidputUInt40(long value) Auto-feed underlying ByteBuffer as necessary.voidputUInt48(long value) Auto-feed underlying ByteBuffer as necessary.voidputUInt53(long value) Auto-feed underlying ByteBuffer as necessary.voidputUInt56(long value) Auto-feed underlying ByteBuffer as necessary.voidputUInt64(long value) Auto-feed underlying ByteBuffer as necessary.voidputUInt7x(long value) Put a flexible encoding int to the flowvoidputUInt8(int value) Auto-feed underlying ByteBuffer as necessary.voidsetCapacity(int capacity) Set the capacity of the underlying buffer.
-
Field Details
-
DEFAULT_CAPACITY
static final int DEFAULT_CAPACITYDefault capacity for underlybing buffer. Highly dependent of implementations and purposes. Basic value only.- See Also:
-
-
Method Details
-
setCapacity
void setCapacity(int capacity) Set the capacity of the underlying buffer.- Parameters:
capacity- the capacity of the underlying buffer
-
putByteArray
Write bytes array. Auto-feed underlying ByteBuffer as necessary.- Parameters:
bytes- the bytes to be written- Throws:
IOException- exception while writing to the flow
-
putByteArray
Put an array of bytes from an array from a given offset for a given length.- Parameters:
array- the byte array to be pushed to the outlfowoffset- offsetlength- length to be read of the array argument- Throws:
IOException- exception while writing to the flow
-
putFlags8
Auto-feed underlying ByteBuffer as necessary.- Parameters:
flags- the flags to be wirtten in the outflow- Throws:
IOException- exception while writing to the flow
-
putBool8
Hack for js part- Parameters:
value- the boolean value to be writtent to the flow- Throws:
IOException- exception while writing to the flow
-
putByte
Directly put byte- Parameters:
b- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt7x
Put a flexible encoding int to the flow- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt8
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt16
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt24
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt31
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt32
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt40
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt48
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt53
Auto-feed underlying ByteBuffer as necessary. This format is adequate to send JAVA long to JS (since JS MAX_INTEGER is 2^53).- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt56
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putUInt64
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putInt8
Write value to the flow (Auto-feed underlying ByteBuffer as necessary).- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putInt16
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putInt32
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putInt32Array
Push an Int32[] array into the flow. Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value written- Throws:
IOException- the exception rasied in the writing process
-
putInt64
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putInt64Array
Put value in thr flow- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putFloat32
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putFloat32Array
Write an float[] array into the flow.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putFloat64
Auto-feed underlying ByteBuffer as necessary.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putFloat64Array
Write double[] value to the outflow.- Parameters:
value- the value to write- Throws:
IOException- exception while writing to the flow
-
putStringUTF8
String is encoded in UTF8.- Parameters:
str- the value to write- Throws:
IOException- exception while writing to the flow
-