From 9008dca31797ba1b05fa3ed6cacb540ef175c666 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Sat, 07 Feb 2009 00:56:52 +0000
Subject: [PATCH] Align ASN1Reader with ASN1Writer by adding readEnumerated().
---
opends/src/server/org/opends/server/protocols/asn1/ASN1ByteSequenceReader.java | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/opends/src/server/org/opends/server/protocols/asn1/ASN1ByteSequenceReader.java b/opends/src/server/org/opends/server/protocols/asn1/ASN1ByteSequenceReader.java
index c05f092..7d8d608 100644
--- a/opends/src/server/org/opends/server/protocols/asn1/ASN1ByteSequenceReader.java
+++ b/opends/src/server/org/opends/server/protocols/asn1/ASN1ByteSequenceReader.java
@@ -271,6 +271,25 @@
/**
* {@inheritDoc}
*/
+ public int readEnumerated() throws ASN1Exception
+ {
+ // Read the header if haven't done so already
+ peekLength();
+
+ if ((peekLength < 1) || (peekLength > 4))
+ {
+ Message message = ERR_ASN1_INTEGER_INVALID_LENGTH.get(peekLength);
+ throw new ASN1Exception(message);
+ }
+
+ // From an implementation point of view, an enumerated value is
+ // equivalent to an integer.
+ return (int) readInteger();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public long readInteger() throws ASN1Exception
{
// Read the header if haven't done so already
--
Gitblit v1.10.0