| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | * required to satisfy the request, that is, if {@code remaining() |
| | | * < 1}. |
| | | */ |
| | | public byte get() throws IndexOutOfBoundsException |
| | | public byte get() |
| | | { |
| | | final byte b = sequence.byteAt(pos); |
| | | pos++; |
| | |
| | | * required to satisfy the request, that is, if {@code remaining() |
| | | * < b.length}. |
| | | */ |
| | | public void get(final byte[] b) throws IndexOutOfBoundsException |
| | | public void get(final byte[] b) |
| | | { |
| | | get(b, 0, b.length); |
| | | } |
| | |
| | | * < length}. |
| | | */ |
| | | public void get(final byte[] b, final int offset, final int length) |
| | | throws IndexOutOfBoundsException |
| | | { |
| | | if (offset < 0 || length < 0 || offset + length > b.length |
| | | || length > remaining()) |
| | |
| | | * If there are fewer bytes remaining in this reader than are |
| | | * required to satisfy the request. |
| | | */ |
| | | public int getBERLength() throws IndexOutOfBoundsException |
| | | public int getBERLength() |
| | | { |
| | | // Make sure we have at least one byte to read. |
| | | int newPos = pos + 1; |
| | |
| | | * < length}. |
| | | */ |
| | | public ByteSequence getByteSequence(final int length) |
| | | throws IndexOutOfBoundsException |
| | | { |
| | | final int newPos = pos + length; |
| | | final ByteSequence subSequence = sequence.subSequence(pos, newPos); |
| | |
| | | * < length}. |
| | | */ |
| | | public ByteString getByteString(final int length) |
| | | throws IndexOutOfBoundsException |
| | | { |
| | | return getByteSequence(length).toByteString(); |
| | | } |
| | |
| | | * required to satisfy the request, that is, if {@code remaining() |
| | | * < 4}. |
| | | */ |
| | | public int getInt() throws IndexOutOfBoundsException |
| | | public int getInt() |
| | | { |
| | | if (remaining() < 4) |
| | | { |
| | |
| | | * required to satisfy the request, that is, if {@code remaining() |
| | | * < 8}. |
| | | */ |
| | | public long getLong() throws IndexOutOfBoundsException |
| | | public long getLong() |
| | | { |
| | | if (remaining() < 8) |
| | | { |
| | |
| | | * required to satisfy the request, that is, if {@code remaining() |
| | | * < 2}. |
| | | */ |
| | | public short getShort() throws IndexOutOfBoundsException |
| | | public short getShort() |
| | | { |
| | | if (remaining() < 2) |
| | | { |
| | |
| | | * required to satisfy the request, that is, if {@code remaining() |
| | | * < length}. |
| | | */ |
| | | public String getString(final int length) throws IndexOutOfBoundsException |
| | | public String getString(final int length) |
| | | { |
| | | if (remaining() < length) |
| | | { |
| | |
| | | * If the position is negative or larger than the length of the |
| | | * underlying byte sequence. |
| | | */ |
| | | public void position(final int pos) throws IndexOutOfBoundsException |
| | | public void position(final int pos) |
| | | { |
| | | if (pos > sequence.length() || pos < 0) |
| | | { |
| | |
| | | * If the new position is less than 0 or greater than the length of |
| | | * the underlying byte sequence. |
| | | */ |
| | | public void skip(final int length) throws IndexOutOfBoundsException |
| | | public void skip(final int length) |
| | | { |
| | | position(pos + length); |
| | | } |