diff --git a/datagen/src/main/java/it/cavallium/stream/SafeDataOutputStream.java b/datagen/src/main/java/it/cavallium/stream/SafeDataOutputStream.java index 44952b8..91eb53e 100644 --- a/datagen/src/main/java/it/cavallium/stream/SafeDataOutputStream.java +++ b/datagen/src/main/java/it/cavallium/stream/SafeDataOutputStream.java @@ -28,6 +28,7 @@ package it.cavallium.stream; import it.cavallium.buffer.IgnoreCoverage; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import org.jetbrains.annotations.NotNull; /** * A data output stream lets an application write primitive Java data @@ -82,6 +83,27 @@ public class SafeDataOutputStream extends SafeFilterOutputStream implements Safe incCount(1); } + /** + * Writes {@code b.length} bytes to this output stream. + *

+ * The {@code write} method of {@code FilterOutputStream} + * calls its {@code write} method of three arguments with the + * arguments {@code b}, {@code 0}, and + * {@code b.length}. + *

+ * Note that this method does not call the one-argument + * {@code write} method of its underlying output stream with + * the single argument {@code b}. + * + * @param b the data to be written. + * @see SafeFilterOutputStream#write(byte[], int, int) + */ + @Override + public void write(byte @NotNull [] b) { + out.write(b); + incCount(b.length); + } + /** * Writes {@code len} bytes from the specified byte array * starting at offset {@code off} to the underlying output stream.