Add readStartSet and readEndSet methods to ASN1Reader for consistency with ASNWriter APIs. Also add writeStartSet(byte) method to ASN1Writer for consistency with sequence related methods.
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSet() throws ASN1Exception { |
| | | reader.readEndSet(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public long readInteger() throws ASN1Exception { |
| | | return reader.readInteger(); |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartSet() throws ASN1Exception { |
| | | reader.readStartSet(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void close() throws IOException { |
| | | reader.close(); |
| | | byteChannel.close(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ASN1Writer writeStartSet(byte type) throws IOException { |
| | | writer.writeStartSet(type); |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * Flush the entire contents of the NIO ByteBuffer out to the |
| | | * channel. |
| | | * |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSequence() throws ASN1Exception |
| | | { |
| | | if(readerStack.isEmpty()) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void skipElement() throws ASN1Exception |
| | | { |
| | | // Read the header if haven't done so already |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readStartSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSequence() throws ASN1Exception |
| | | { |
| | | if(streamStack.isEmpty()) |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void readEndSet() throws ASN1Exception |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public void skipElement() throws ASN1Exception |
| | | { |
| | | // Read the header if haven't done so already |
| | |
| | | */ |
| | | public ASN1Writer writeStartSet() throws IOException |
| | | { |
| | | return writeStartSequence(UNIVERSAL_SET_TYPE); |
| | | return writeStartSet(UNIVERSAL_SET_TYPE); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ASN1Writer writeStartSet(byte type) throws IOException |
| | | { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | return writeStartSequence(type); |
| | | } |
| | | |
| | | /** |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.protocols.asn1; |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Finishes reading a set. Any elements not read in the set will be |
| | | * discarded. |
| | | * |
| | | * @throws ASN1Exception |
| | | * If an error occurs while advancing to the end of the set. |
| | | */ |
| | | void readEndSet() throws ASN1Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Reads the next ASN.1 element as an integer and advances the |
| | | * cursor. |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * Reads the next ASN.1 element as a set. All further reads will read |
| | | * the elements in the sequence until {@link #readEndSet()} is called. |
| | | * |
| | | * @throws ASN1Exception |
| | | * If the next element is not a set. |
| | | */ |
| | | void readStartSet() throws ASN1Exception; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Advances this ASN.1 reader beyond the next ASN.1 element without |
| | | * decoding it. |
| | | * |
| | |
| | | |
| | | /** |
| | | * Writes a sequence element using the provided type tag. All |
| | | * further writes will be part of this set until |
| | | * further writes will be part of this sequence until |
| | | * {@link #writeEndSequence()} is called. |
| | | * |
| | | * @param type |
| | |
| | | * If an error occurs while writing. |
| | | */ |
| | | ASN1Writer writeStartSet() throws IOException; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Writes a set element using the provided type tag. All further |
| | | * writes will be part of this set until {@link #writeEndSet()} is |
| | | * called. |
| | | * |
| | | * @param type |
| | | * The type tag to use. |
| | | * @return a reference to this object. |
| | | * @throws IOException |
| | | * If an error occurs while writing. |
| | | */ |
| | | ASN1Writer writeStartSet(byte type) throws IOException; |
| | | } |