| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | } |
| | | |
| | | byteBuffer.clear(); |
| | | int read = byteChannel.read(byteBuffer); |
| | | byteBuffer.flip(); |
| | | return read; |
| | | try |
| | | { |
| | | int read = byteChannel.read(byteBuffer); |
| | | return read; |
| | | } |
| | | finally |
| | | { |
| | | // Make sure that the buffer is flipped even if the read fails in order to |
| | | // ensure that subsequent calls which query the remaining data return |
| | | // valid results. |
| | | byteBuffer.flip(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns {@code true} if this ASN.1 reader contains unread data. |
| | | * |
| | | * @return {@code true} if this ASN.1 reader contains unread data. |
| | | */ |
| | | public boolean hasRemainingData() |
| | | { |
| | | return (saveBufferReader.remaining() != 0) || (byteBuffer.remaining() != 0); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public int peekLength() throws ASN1Exception { |