Fast exit when trying to write an empty array

This commit is contained in:
TheMode 2021-08-19 11:54:26 +02:00
parent 62916239b5
commit 72bda2c4ec

View File

@ -235,6 +235,7 @@ public class BinaryWriter extends OutputStream {
* @param bytes the byte array to write * @param bytes the byte array to write
*/ */
public void writeBytes(byte @NotNull [] bytes) { public void writeBytes(byte @NotNull [] bytes) {
if (bytes.length == 0) return;
ensureSize(bytes.length); ensureSize(bytes.length);
buffer.put(bytes); buffer.put(bytes);
} }