You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/03/27 20:42:40 UTC

svn commit: r159171 - in directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util: ObjectFactory.java StringUtils.java

Author: elecharny
Date: Sun Mar 27 10:42:39 2005
New Revision: 159171

URL: http://svn.apache.org/viewcvs?view=rev&rev=159171
Log:
A first working version of the new ASN.1 LDAP decoder.

Added:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/ObjectFactory.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/StringUtils.java

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/ObjectFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/ObjectFactory.java?view=auto&rev=159171
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/ObjectFactory.java (added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/ObjectFactory.java Sun Mar 27 10:42:39 2005
@@ -0,0 +1,36 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.asn1.util;
+
+import org.apache.asn1.util.pools.PoolObject;
+
+/**
+ * This interface must be implemented by each poolable object 
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface ObjectFactory
+{
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Create an object.
+     *
+     * @return The object created.
+     */
+    public PoolObject makeObject();
+}

Added: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/StringUtils.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/StringUtils.java?view=auto&rev=159171
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/StringUtils.java (added)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/util/StringUtils.java Sun Mar 27 10:42:39 2005
@@ -0,0 +1,46 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.asn1.util;
+
+/**
+ * Little helper class. Nothing that should stay here, but I need those 
+ * to debug.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StringUtils
+{
+    //~ Static fields/initializers -----------------------------------------------------------------
+
+    /** Hex chars */
+    private static final byte[] HEX =
+        new byte[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+
+    //~ Methods ------------------------------------------------------------------------------------
+
+    /**
+     * Helper function that dump a byte in hex form
+     * 
+     * @param octet The byte to dump
+     * @return A string representation of the byte
+     */
+    public static String dumpByte( byte octet )
+    {
+        return new String(
+                new byte[] { '[', HEX[( octet & 0x00F0 ) >> 4], HEX[octet & 0x000F], ']' } );
+    }
+}