diff artifact-database/src/main/java/de/intevation/artifactdatabase/StringUtils.java @ 87:0f48188a6e02

Added some javadoc to the artifactdatabase module. Not done yet. artifacts/trunk@839 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 26 Mar 2010 11:40:28 +0000
parents 8447467cef86
children 933bbc9fc11f
line wrap: on
line diff
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/StringUtils.java	Fri Mar 26 10:04:34 2010 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/StringUtils.java	Fri Mar 26 11:40:28 2010 +0000
@@ -11,16 +11,27 @@
 import org.apache.log4j.Logger;
 
 /**
+ * Commonly used string functions.
+ *
  * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public final class StringUtils
 {
     private static Logger logger = Logger.getLogger(StringUtils.class);
 
+    /**
+     * Generated a random UUIDv4 in form of a string.
+     * @return the UUID
+     */
     public static final String newUUID() {
         return UUID.randomUUID().toString();
     }
 
+    /**
+     * Checks if a given string is a valid UUID.
+     * @param uuid The string to test.
+     * @return true if the string is a valid UUID else false.
+     */
     public static final boolean checkUUID(String uuid) {
         try {
             UUID.fromString(uuid);
@@ -32,6 +43,11 @@
         return true;
     }
 
+    /**
+     * Returns the UTF-8 byte array representation of a given string.
+     * @param s The string to be transformed.
+     * @return The byte array representation.
+     */
     public static final byte [] getUTF8Bytes(String s) {
         try {
             return s.getBytes("UTF-8");
@@ -42,6 +58,13 @@
         }
     }
 
+    /**
+     * Tries to convert a Base64 encoded string into the
+     * corresponing byte array.
+     * @param s The Base64 encoded string
+     * @return The byte array representation or null if
+     * an decoding error occurs.
+     */
     public static final byte [] decodeHex(String s) {
         try {
             return Hex.decodeHex(s.toCharArray());

http://dive4elements.wald.intevation.org