/** * {@inheritDoc} */ @Override public final IoBuffer getSlice(int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } int pos = position(); int limit = limit(); int nextPos = pos + length; if (limit < nextPos) { throw new IndexOutOfBoundsException("position + length (" + nextPos + ") is greater " + "than limit (" + limit + ")."); } limit(pos + length); IoBuffer slice = slice(); position(nextPos); limit(limit); return slice; }
/** * {@inheritDoc} */ @Override public final IoBuffer getSlice(int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } int pos = position(); int limit = limit(); int nextPos = pos + length; if (limit < nextPos) { throw new IndexOutOfBoundsException("position + length (" + nextPos + ") is greater " + "than limit (" + limit + ")."); } limit(pos + length); IoBuffer slice = slice(); position(nextPos); limit(limit); return slice; }
/** * {@inheritDoc} */ @Override public final IoBuffer getSlice(int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } int pos = position(); int limit = limit(); int nextPos = pos + length; if (limit < nextPos) { throw new IndexOutOfBoundsException("position + length (" + nextPos + ") is greater " + "than limit (" + limit + ")."); } limit(pos + length); IoBuffer slice = slice(); position(nextPos); limit(limit); return slice; }
/** * {@inheritDoc} */ @Override public final IoBuffer getSlice(int index, int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } int pos = position(); int limit = limit(); if (index > limit) { throw new IllegalArgumentException("index: " + index); } int endIndex = index + length; if (endIndex > limit) { throw new IndexOutOfBoundsException("index + length (" + endIndex + ") is greater " + "than limit (" + limit + ")."); } clear(); limit(endIndex); position(index); IoBuffer slice = slice(); limit(limit); position(pos); return slice; }
/** * {@inheritDoc} */ @Override public final IoBuffer getSlice(int index, int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } int pos = position(); int limit = limit(); if (index > limit) { throw new IllegalArgumentException("index: " + index); } int endIndex = index + length; if (endIndex > limit) { throw new IndexOutOfBoundsException("index + length (" + endIndex + ") is greater " + "than limit (" + limit + ")."); } clear(); limit(endIndex); position(index); IoBuffer slice = slice(); limit(limit); position(pos); return slice; }
/** * {@inheritDoc} */ @Override public final IoBuffer getSlice(int index, int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } int limit = limit(); if (index > limit) { throw new IllegalArgumentException("index: " + index); } int endIndex = index + length; if (capacity() < endIndex) { throw new IndexOutOfBoundsException("index + length (" + endIndex + ") is greater " + "than capacity (" + capacity() + ")."); } clear(); position(index); limit(endIndex); IoBuffer slice = slice(); position(index); limit(limit); return slice; }