private void checkBounds(int index, int accessSize) { int lower = index; int upper = index + accessSize; if (lower < first()) { throw new IndexOutOfBoundsException("Index " + lower + " less than start " + first() + "."); } if (upper > last()) { throw new IndexOutOfBoundsException("Index " + upper + " greater than length " + last() + "."); } } }
private void checkBounds(int index, int accessSize) { int lower = index; int upper = index + accessSize; if (lower < first()) { throw new IndexOutOfBoundsException("Index " + lower + " less than start " + first() + "."); } if (upper > last()) { throw new IndexOutOfBoundsException("Index " + upper + " greater than length " + last() + "."); } } }
private void checkBounds( int index, int accessSize ) { int lower = index; int upper = index + accessSize; if ( lower < first() ) { throw new IndexOutOfBoundsException( "Index " + lower + " less than start " + first() + "." ); } if ( upper > last() ) { throw new IndexOutOfBoundsException( "Index " + upper + " greater than length " + last() + "." ); } }
cursor = cba.cursor(cba.first(), new CursorListener() {
cursor = cba.cursor(cba.first(), new CursorListener() {
/** * * Creates a new instance of CompositeByteArrayRelativeBase. * * @param cba * The {@link CompositeByteArray} that will be the base for this class */ public CompositeByteArrayRelativeBase( CompositeByteArray cba ) { this.cba = cba; cursor = cba.cursor( cba.first(), new CursorListener() { public void enteredFirstComponent( int componentIndex, ByteArray component ) { // Do nothing. } public void enteredLastComponent( int componentIndex, ByteArray component ) { assert false; } public void enteredNextComponent( int componentIndex, ByteArray component ) { cursorPassedFirstComponent(); } public void enteredPreviousComponent( int componentIndex, ByteArray component ) { assert false; } } ); }
@Override protected void cursorPassedFirstComponent() { if (autoFlush) { flushTo(cba.first() + cba.getFirst().length()); } }
@Override protected void cursorPassedFirstComponent() { if ( autoFlush ) { flushTo( cba.first() + cba.getFirst().length() ); } }
@Override protected void cursorPassedFirstComponent() { if (autoFlush) { flushTo(cba.first() + cba.getFirst().length()); } }
int actualLength = last() - first();
int actualLength = last() - first();
int actualLength = last() - first();