Fix writer to array conversion

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-08-03 19:54:32 +02:00
parent fbf6479135
commit 9f1efb0932

View File

@ -317,6 +317,7 @@ public class BinaryWriter extends OutputStream {
* @return the byte array containing all the {@link BinaryWriter} data
*/
public byte[] toByteArray() {
buffer.flip();
byte[] bytes = new byte[buffer.remaining()];
buffer.get(bytes);
return bytes;