@Override public void seek(long position) { ensureCapacity(position); count = (int) position; }
@Override public void writeByte(byte b) throws IOException { ensureCapacity(count + 1L); bytes.set(count, b); count++; }
@Override void ensureCapacity(long offset) { final ByteArray prevBytes = this.bytes; super.ensureCapacity(offset); if (prevBytes != this.bytes) { // re-create the releasable with the new reference releasable = Releasables.releaseOnce(this.bytes); } }
@Override public void writeBytes(byte[] b, int offset, int length) { // nothing to copy if (length == 0) { return; } // illegal args: offset and/or length exceed array size if (b.length < (offset + length)) { throw new IllegalArgumentException("Illegal offset " + offset + "/length " + length + " for byte[] of length " + b.length); } // get enough pages for new size ensureCapacity(((long) count) + length); // bulk copy bytes.set(count, b, offset, length); // advance count += length; }
@Override public void seek(long position) { ensureCapacity(position); count = (int) position; }
@Override public void seek(long position) { ensureCapacity(position); count = (int) position; }
@Override public void seek(long position) { ensureCapacity(position); count = (int) position; }
@Override public void seek(long position) { ensureCapacity(position); count = (int) position; }
@Override public void writeByte(byte b) throws IOException { ensureCapacity(count + 1L); bytes.set(count, b); count++; }
@Override public void writeByte(byte b) throws IOException { ensureCapacity(count + 1L); bytes.set(count, b); count++; }
@Override void ensureCapacity(long offset) { final ByteArray prevBytes = this.bytes; super.ensureCapacity(offset); if (prevBytes != this.bytes) { // re-create the releasable with the new reference releasable = Releasables.releaseOnce(this.bytes); } }
@Override void ensureCapacity(long offset) { final ByteArray prevBytes = this.bytes; super.ensureCapacity(offset); if (prevBytes != this.bytes) { // re-create the releasable with the new reference releasable = Releasables.releaseOnce(this.bytes); } }
@Override public void writeByte(byte b) throws IOException { ensureCapacity(count + 1L); bytes.set(count, b); count++; }
@Override public void writeByte(byte b) throws IOException { ensureCapacity(count + 1L); bytes.set(count, b); count++; }
@Override void ensureCapacity(long offset) { final ByteArray prevBytes = this.bytes; super.ensureCapacity(offset); if (prevBytes != this.bytes) { // re-create the releasable with the new reference releasable = Releasables.releaseOnce(this.bytes); } }
@Override public void writeBytes(byte[] b, int offset, int length) { // nothing to copy if (length == 0) { return; } // illegal args: offset and/or length exceed array size if (b.length < (offset + length)) { throw new IllegalArgumentException("Illegal offset " + offset + "/length " + length + " for byte[] of length " + b.length); } // get enough pages for new size ensureCapacity(((long) count) + length); // bulk copy bytes.set(count, b, offset, length); // advance count += length; }
@Override public void writeBytes(byte[] b, int offset, int length) { // nothing to copy if (length == 0) { return; } // illegal args: offset and/or length exceed array size if (b.length < (offset + length)) { throw new IllegalArgumentException("Illegal offset " + offset + "/length " + length + " for byte[] of length " + b.length); } // get enough pages for new size ensureCapacity(((long) count) + length); // bulk copy bytes.set(count, b, offset, length); // advance count += length; }
@Override public void writeBytes(byte[] b, int offset, int length) throws IOException { // nothing to copy if (length == 0) { return; } // illegal args: offset and/or length exceed array size if (b.length < (offset + length)) { throw new IllegalArgumentException("Illegal offset " + offset + "/length " + length + " for byte[] of length " + b.length); } // get enough pages for new size ensureCapacity(((long) count) + length); // bulk copy bytes.set(count, b, offset, length); // advance count += length; }
@Override public void writeBytes(byte[] b, int offset, int length) { // nothing to copy if (length == 0) { return; } // illegal args: offset and/or length exceed array size if (b.length < (offset + length)) { throw new IllegalArgumentException("Illegal offset " + offset + "/length " + length + " for byte[] of length " + b.length); } // get enough pages for new size ensureCapacity(((long) count) + length); // bulk copy bytes.set(count, b, offset, length); // advance count += length; }