You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dr...@apache.org on 2015/02/01 02:11:39 UTC

[2/2] directory-kerberos git commit: added some java doc

added some java doc


Project: http://git-wip-us.apache.org/repos/asf/directory-kerberos/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerberos/commit/b44c8979
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerberos/tree/b44c8979
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerberos/diff/b44c8979

Branch: refs/heads/javadoc
Commit: b44c8979ea3daf5cba132a7fffdb5184a068bb8d
Parents: b5da34b
Author: Drankye <dr...@gmail.com>
Authored: Fri Jan 30 11:34:16 2015 +0800
Committer: Drankye <dr...@gmail.com>
Committed: Fri Jan 30 11:34:16 2015 +0800

----------------------------------------------------------------------
 .../java/org/apache/kerby/asn1/Asn1Factory.java | 13 ++++++++++
 .../org/apache/kerby/asn1/Asn1InputBuffer.java  | 27 +++++++++++++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/b44c8979/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java
index 2762476..ea4eca8 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1Factory.java
@@ -23,8 +23,16 @@ import org.apache.kerby.asn1.type.Asn1Collection;
 import org.apache.kerby.asn1.type.Asn1Simple;
 import org.apache.kerby.asn1.type.Asn1Type;
 
+/**
+ * ASN1 type factory
+ */
 public class Asn1Factory {
 
+    /**
+     * Create an ASN1 type with specified tag number
+     * @param tagNo
+     * @return ASN1 type
+     */
     public static Asn1Type create(int tagNo) {
         UniversalTag tagNoEnum = UniversalTag.fromValue(tagNo);
         if (tagNoEnum != UniversalTag.UNKNOWN) {
@@ -33,6 +41,11 @@ public class Asn1Factory {
         throw new IllegalArgumentException("Unexpected tag " + tagNo);
     }
 
+    /**
+     * Create an ASN1 type with specified tag
+     * @param tagNo
+     * @return ASN1 type
+     */
     public static Asn1Type create(UniversalTag tagNo) {
         if (Asn1Simple.isSimple(tagNo)) {
             return Asn1Simple.createSimple(tagNo);

http://git-wip-us.apache.org/repos/asf/directory-kerberos/blob/b44c8979/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java
----------------------------------------------------------------------
diff --git a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java
index 934b0c1..985bd7e 100644
--- a/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java
+++ b/kerby-asn1/src/main/java/org/apache/kerby/asn1/Asn1InputBuffer.java
@@ -27,23 +27,43 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 
 /**
- * Asn1 decoder
+ * Asn1 decoder. Given an input stream, it validates and parses
+ * according to ASN1 spec, and the resultant object can be read
+ * and read until exhausted.
  */
 public class Asn1InputBuffer {
     private final LimitedByteBuffer limitedBuffer;
 
+    /**
+     * Constructor with bytes.
+     * @param bytes
+     */
     public Asn1InputBuffer(byte[] bytes) {
         this(new LimitedByteBuffer(bytes));
     }
 
+    /**
+     * Constructor with a ByteBuffer.
+     * @param byteBuffer
+     */
     public Asn1InputBuffer(ByteBuffer byteBuffer) {
         this(new LimitedByteBuffer(byteBuffer));
     }
 
+    /**
+     * Constructor with LimitedByteBuffer.
+     * @param limitedByteBuffer
+     */
     public Asn1InputBuffer(LimitedByteBuffer limitedByteBuffer) {
         this.limitedBuffer = limitedByteBuffer;
     }
 
+    /**
+     * Parse and read ASN1 object from the stream. If it's already
+     * exhausted then null will be returned to indicate the end.
+     * @return an ASN1 object if available otherwise null
+     * @throws IOException
+     */
     public Asn1Type read() throws IOException {
         if (! limitedBuffer.available()) {
             return null;
@@ -60,6 +80,11 @@ public class Asn1InputBuffer {
         return one;
     }
 
+    /**
+     *
+     * @param bytes
+     * @throws IOException
+     */
     public void readBytes(byte[] bytes) throws IOException {
         limitedBuffer.readBytes(bytes);
     }