Skip to content

Commit 66af2f6

Browse files
committed
ByteBank: add appendBytes method with offset
1 parent 09a59bc commit 66af2f6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/org/scijava/io/ByteBank.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,18 @@ default int getBytes(long startPos, byte[] bytes) {
8080
* @param length the number of elements to append from the bytes array
8181
*/
8282
default void appendBytes(byte[] bytes, int length) {
83-
setBytes(getMaxPos() + 1, bytes, 0, length);
83+
appendBytes(bytes, 0, length);
84+
}
85+
86+
/**
87+
* Appends the given bytes to the buffer
88+
*
89+
* @param bytes the array containing the bytes to append to the buffer
90+
* @param offset the offset in the bytes array
91+
* @param length the number of elements to append from the bytes array
92+
*/
93+
default void appendBytes(byte[] bytes, int offset, int length) {
94+
setBytes(getMaxPos() + 1, bytes, offset, length);
8495
}
8596

8697
/**

0 commit comments

Comments
 (0)