You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/06/20 21:04:12 UTC
svn commit: r1352268 [2/5] - in /commons/proper/codec/trunk/src:
main/java/org/apache/commons/codec/
main/java/org/apache/commons/codec/binary/
main/java/org/apache/commons/codec/digest/
main/java/org/apache/commons/codec/language/ main/java/org/apache...
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -27,7 +27,7 @@ import org.apache.commons.codec.binary.B
/**
* Abstract superclass for Base-N output streams.
- *
+ *
* @since 1.5
*/
public class BaseNCodecOutputStream extends FilterOutputStream {
@@ -49,7 +49,7 @@ public class BaseNCodecOutputStream exte
/**
* Writes the specified <code>byte</code> to this output stream.
- *
+ *
* @param i
* source byte
* @throws IOException
@@ -64,14 +64,14 @@ public class BaseNCodecOutputStream exte
/**
* Writes <code>len</code> bytes from the specified <code>b</code> array starting at <code>offset</code> to this
* output stream.
- *
+ *
* @param b
* source byte array
* @param offset
* where to start reading the bytes
* @param len
* maximum number of bytes to write
- *
+ *
* @throws IOException
* if an I/O error occurs.
* @throws NullPointerException
@@ -100,7 +100,7 @@ public class BaseNCodecOutputStream exte
/**
* Flushes this output stream and forces any buffered output bytes to be written out to the stream. If propogate is
* true, the wrapped stream will also be flushed.
- *
+ *
* @param propogate
* boolean flag to indicate whether the wrapped OutputStream should also be flushed.
* @throws IOException
@@ -122,7 +122,7 @@ public class BaseNCodecOutputStream exte
/**
* Flushes this output stream and forces any buffered output bytes to be written out to the stream.
- *
+ *
* @throws IOException
* if an I/O error occurs.
*/
@@ -133,7 +133,7 @@ public class BaseNCodecOutputStream exte
/**
* Closes this output stream and releases any system resources associated with the stream.
- *
+ *
* @throws IOException
* if an I/O error occurs.
*/
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -24,12 +24,12 @@ import org.apache.commons.codec.EncoderE
/**
* Converts between byte arrays and strings of "0"s and "1"s.
- *
+ *
* <p>This class is immutable and thread-safe.</p>
- *
- * TODO: may want to add more bit vector functions like and/or/xor/nand
+ *
+ * TODO: may want to add more bit vector functions like and/or/xor/nand
* TODO: also might be good to generate boolean[] from byte[] et cetera.
- *
+ *
* @since 1.3
* @version $Id$
*/
@@ -72,7 +72,7 @@ public class BinaryCodec implements Bina
/**
* Converts an array of raw binary data into an array of ASCII 0 and 1 characters.
- *
+ *
* @param raw
* the raw binary data to convert
* @return 0 and 1 ASCII character bytes one for each bit of the argument
@@ -85,7 +85,7 @@ public class BinaryCodec implements Bina
/**
* Converts an array of raw binary data into an array of ASCII 0 and 1 chars.
- *
+ *
* @param raw
* the raw binary data to convert
* @return 0 and 1 ASCII character chars one for each bit of the argument
@@ -103,7 +103,7 @@ public class BinaryCodec implements Bina
/**
* Decodes a byte array where each byte represents an ASCII '0' or '1'.
- *
+ *
* @param ascii
* each byte represents an ASCII '0' or '1'
* @return the raw encoded binary where each bit corresponds to a byte in the byte array argument
@@ -130,7 +130,7 @@ public class BinaryCodec implements Bina
/**
* Decodes a byte array where each byte represents an ASCII '0' or '1'.
- *
+ *
* @param ascii
* each byte represents an ASCII '0' or '1'
* @return the raw encoded binary where each bit corresponds to a byte in the byte array argument
@@ -143,7 +143,7 @@ public class BinaryCodec implements Bina
/**
* Decodes a String where each char of the String represents an ASCII '0' or '1'.
- *
+ *
* @param ascii
* String of '0' and '1' characters
* @return the raw encoded binary where each bit corresponds to a byte in the byte array argument
@@ -163,7 +163,7 @@ public class BinaryCodec implements Bina
// ------------------------------------------------------------------------
/**
* Decodes a char array where each char represents an ASCII '0' or '1'.
- *
+ *
* @param ascii
* each char represents an ASCII '0' or '1'
* @return the raw encoded binary where each bit corresponds to a char in the char array argument
@@ -190,7 +190,7 @@ public class BinaryCodec implements Bina
/**
* Decodes a byte array where each byte represents an ASCII '0' or '1'.
- *
+ *
* @param ascii
* each byte represents an ASCII '0' or '1'
* @return the raw encoded binary where each bit corresponds to a byte in the byte array argument
@@ -217,7 +217,7 @@ public class BinaryCodec implements Bina
/**
* Returns {@code true} if the given array is {@code null} or empty (size 0.)
- *
+ *
* @param array
* the source array
* @return {@code true} if the given array is {@code null} or empty (size 0.)
@@ -229,7 +229,7 @@ public class BinaryCodec implements Bina
/**
* Converts an array of raw binary data into an array of ASCII 0 and 1 character bytes - each byte is a truncated
* char.
- *
+ *
* @param raw
* the raw binary data to convert
* @return an array of 0 and 1 character bytes for each bit of the argument
@@ -259,7 +259,7 @@ public class BinaryCodec implements Bina
/**
* Converts an array of raw binary data into an array of ASCII 0 and 1 characters.
- *
+ *
* @param raw
* the raw binary data to convert
* @return an array of 0 and 1 characters for each bit of the argument
@@ -289,7 +289,7 @@ public class BinaryCodec implements Bina
/**
* Converts an array of raw binary data into a String of ASCII 0 and 1 characters.
- *
+ *
* @param raw
* the raw binary data to convert
* @return a String of 0 and 1 characters representing the binary data
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Hex.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Hex.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Hex.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Hex.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -30,9 +30,9 @@ import org.apache.commons.codec.EncoderE
/**
* Converts hexadecimal Strings. The charset used for certain operation can be set, the default is set in
* {@link #DEFAULT_CHARSET_NAME}
- *
+ *
* This class is thread-safe.
- *
+ *
* @since 1.1
* @version $Id$
*/
@@ -40,14 +40,14 @@ public class Hex implements BinaryEncode
/**
* Default charset name is {@link Charsets#UTF_8}
- *
+ *
* @since 1.7
*/
public static final Charset DEFAULT_CHARSET = Charsets.UTF_8;
/**
* Default charset name is {@link CharEncoding#UTF_8}
- *
+ *
* @since 1.4
*/
public static final String DEFAULT_CHARSET_NAME = CharEncoding.UTF_8;
@@ -66,7 +66,7 @@ public class Hex implements BinaryEncode
* Converts an array of characters representing hexadecimal values into an array of bytes of those same values. The
* returned array will be half the length of the passed array, as it takes two characters to represent any given
* byte. An exception is thrown if the passed char array has an odd number of elements.
- *
+ *
* @param data
* An array of characters containing hexadecimal digits
* @return A byte array containing binary data decoded from the supplied char array.
@@ -99,7 +99,7 @@ public class Hex implements BinaryEncode
* Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
* The returned array will be double the length of the passed array, as it takes two characters to represent any
* given byte.
- *
+ *
* @param data
* a byte[] to convert to Hex characters
* @return A char[] containing hexadecimal characters
@@ -112,7 +112,7 @@ public class Hex implements BinaryEncode
* Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
* The returned array will be double the length of the passed array, as it takes two characters to represent any
* given byte.
- *
+ *
* @param data
* a byte[] to convert to Hex characters
* @param toLowerCase
@@ -128,7 +128,7 @@ public class Hex implements BinaryEncode
* Converts an array of bytes into an array of characters representing the hexadecimal values of each byte in order.
* The returned array will be double the length of the passed array, as it takes two characters to represent any
* given byte.
- *
+ *
* @param data
* a byte[] to convert to Hex characters
* @param toDigits
@@ -150,7 +150,7 @@ public class Hex implements BinaryEncode
/**
* Converts an array of bytes into a String representing the hexadecimal values of each byte in order. The returned
* String will be double the length of the passed array, as it takes two characters to represent any given byte.
- *
+ *
* @param data
* a byte[] to convert to Hex characters
* @return A String containing hexadecimal characters
@@ -162,7 +162,7 @@ public class Hex implements BinaryEncode
/**
* Converts a hexadecimal character to an integer.
- *
+ *
* @param ch
* A character to convert to an integer digit
* @param index
@@ -191,7 +191,7 @@ public class Hex implements BinaryEncode
/**
* Creates a new codec with the given Charset.
- *
+ *
* @param charset
* the charset.
* @since 1.7
@@ -202,7 +202,7 @@ public class Hex implements BinaryEncode
/**
* Creates a new codec with the given charset name.
- *
+ *
* @param charsetName
* the charset name.
* @throws UnsupportedCharsetException
@@ -218,7 +218,7 @@ public class Hex implements BinaryEncode
* Converts an array of character bytes representing hexadecimal values into an array of bytes of those same values.
* The returned array will be half the length of the passed array, as it takes two characters to represent any given
* byte. An exception is thrown if the passed char array has an odd number of elements.
- *
+ *
* @param array
* An array of character bytes containing hexadecimal digits
* @return A byte array containing binary data decoded from the supplied byte array (representing characters).
@@ -235,7 +235,7 @@ public class Hex implements BinaryEncode
* Converts a String or an array of character bytes representing hexadecimal values into an array of bytes of those
* same values. The returned array will be half the length of the passed String or array, as it takes two characters
* to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
- *
+ *
* @param object
* A String or, an array of character bytes containing hexadecimal digits
* @return A byte array containing binary data decoded from the supplied byte array (representing characters).
@@ -262,7 +262,7 @@ public class Hex implements BinaryEncode
* The conversion from hexadecimal characters to the returned bytes is performed with the charset named by
* {@link #getCharset()}.
* </p>
- *
+ *
* @param array
* a byte[] to convert to Hex characters
* @return A byte[] containing the bytes of the hexadecimal characters
@@ -282,7 +282,7 @@ public class Hex implements BinaryEncode
* The conversion from hexadecimal characters to bytes to be encoded to performed with the charset named by
* {@link #getCharset()}.
* </p>
- *
+ *
* @param object
* a String, or byte[] to convert to Hex characters
* @return A char[] containing hexadecimal characters
@@ -302,7 +302,7 @@ public class Hex implements BinaryEncode
/**
* Gets the charset.
- *
+ *
* @return the charset.
* @since 1.7
*/
@@ -312,7 +312,7 @@ public class Hex implements BinaryEncode
/**
* Gets the charset name.
- *
+ *
* @return the charset name.
* @since 1.4
*/
@@ -322,7 +322,7 @@ public class Hex implements BinaryEncode
/**
* Returns a string representation of the object, which includes the charset name.
- *
+ *
* @return a string representation of the object.
*/
@Override
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/StringUtils.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/StringUtils.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/StringUtils.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -26,7 +26,7 @@ import org.apache.commons.codec.Charsets
/**
* Converts String to and from bytes using the encodings required by the Java specification. These encodings are specified in <a
* href="http://download.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
- *
+ *
* <p>This class is immutable and thread-safe.</p>
*
* @see CharEncoding
@@ -37,8 +37,8 @@ import org.apache.commons.codec.Charsets
public class StringUtils {
/**
- * Calls {@link String#getBytes(Charset)}
- *
+ * Calls {@link String#getBytes(Charset)}
+ *
* @param string
* The string to encode (if null, return null).
* @param charset
@@ -55,7 +55,7 @@ public class StringUtils {
/**
* Encodes the given string into a sequence of bytes using the ISO-8859-1 charset, storing the result into a new
* byte array.
- *
+ *
* @param string
* the String to encode, may be {@code null}
* @return encoded bytes, or {@code null} if the input string was {@code null}
@@ -78,7 +78,7 @@ public class StringUtils {
* This method catches {@link UnsupportedEncodingException} and rethrows it as {@link IllegalStateException}, which
* should never happen for a required charset name. Use this method when the encoding is required to be in the JRE.
* </p>
- *
+ *
* @param string
* the String to encode, may be {@code null}
* @param charsetName
@@ -104,7 +104,7 @@ public class StringUtils {
/**
* Encodes the given string into a sequence of bytes using the US-ASCII charset, storing the result into a new byte
* array.
- *
+ *
* @param string
* the String to encode, may be {@code null}
* @return encoded bytes, or {@code null} if the input string was {@code null}
@@ -122,7 +122,7 @@ public class StringUtils {
/**
* Encodes the given string into a sequence of bytes using the UTF-16 charset, storing the result into a new byte
* array.
- *
+ *
* @param string
* the String to encode, may be {@code null}
* @return encoded bytes, or {@code null} if the input string was {@code null}
@@ -140,7 +140,7 @@ public class StringUtils {
/**
* Encodes the given string into a sequence of bytes using the UTF-16BE charset, storing the result into a new byte
* array.
- *
+ *
* @param string
* the String to encode, may be {@code null}
* @return encoded bytes, or {@code null} if the input string was {@code null}
@@ -158,7 +158,7 @@ public class StringUtils {
/**
* Encodes the given string into a sequence of bytes using the UTF-16LE charset, storing the result into a new byte
* array.
- *
+ *
* @param string
* the String to encode, may be {@code null}
* @return encoded bytes, or {@code null} if the input string was {@code null}
@@ -176,7 +176,7 @@ public class StringUtils {
/**
* Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte
* array.
- *
+ *
* @param string
* the String to encode, may be {@code null}
* @return encoded bytes, or {@code null} if the input string was {@code null}
@@ -197,7 +197,7 @@ public class StringUtils {
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the given charset.
- *
+ *
* @param bytes
* The bytes to be decoded into characters
* @param charset
@@ -218,7 +218,7 @@ public class StringUtils {
* This method catches {@link UnsupportedEncodingException} and re-throws it as {@link IllegalStateException}, which
* should never happen for a required charset name. Use this method when the encoding is required to be in the JRE.
* </p>
- *
+ *
* @param bytes
* The bytes to be decoded into characters, may be {@code null}
* @param charsetName
@@ -244,7 +244,7 @@ public class StringUtils {
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the ISO-8859-1 charset.
- *
+ *
* @param bytes
* The bytes to be decoded into characters, may be {@code null}
* @return A new <code>String</code> decoded from the specified array of bytes using the ISO-8859-1 charset, or
@@ -260,7 +260,7 @@ public class StringUtils {
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the US-ASCII charset.
- *
+ *
* @param bytes
* The bytes to be decoded into characters
* @return A new <code>String</code> decoded from the specified array of bytes using the US-ASCII charset,
@@ -276,7 +276,7 @@ public class StringUtils {
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16 charset.
- *
+ *
* @param bytes
* The bytes to be decoded into characters
* @return A new <code>String</code> decoded from the specified array of bytes using the UTF-16 charset
@@ -292,7 +292,7 @@ public class StringUtils {
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16BE charset.
- *
+ *
* @param bytes
* The bytes to be decoded into characters
* @return A new <code>String</code> decoded from the specified array of bytes using the UTF-16BE charset,
@@ -308,7 +308,7 @@ public class StringUtils {
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-16LE charset.
- *
+ *
* @param bytes
* The bytes to be decoded into characters
* @return A new <code>String</code> decoded from the specified array of bytes using the UTF-16LE charset,
@@ -324,7 +324,7 @@ public class StringUtils {
/**
* Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-8 charset.
- *
+ *
* @param bytes
* The bytes to be decoded into characters
* @return A new <code>String</code> decoded from the specified array of bytes using the UTF-8 charset,
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/B64.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/B64.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/B64.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/B64.java Wed Jun 20 19:04:08 2012
@@ -7,7 +7,7 @@
* 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.
@@ -20,11 +20,11 @@ import java.util.Random;
/**
* Base64 like method to convert binary bytes into ASCII chars.
- *
+ *
* TODO: Can Base64 be reused?
- *
+ *
* <p>This class is immutable and thread-safe.</p>
- *
+ *
* @version $Id$
* @since 1.7
*/
@@ -37,7 +37,7 @@ class B64 {
/**
* Base64 like conversion of bytes to ASCII chars.
- *
+ *
* @param b2
* A byte from the result.
* @param b1
@@ -62,7 +62,7 @@ class B64 {
/**
* Generates a string of random chars from the B64T set.
- *
+ *
* @param num
* Number of chars to generate.
*/
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Crypt.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Crypt.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Crypt.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Crypt.java Wed Jun 20 19:04:08 2012
@@ -20,11 +20,11 @@ import org.apache.commons.codec.Charsets
/**
* GNU libc crypt(3) compatible hash method.
- *
+ *
* See {@link #crypt(String, String)} for further details.
- *
+ *
* <p>This class is immutable and thread-safe.</p>
- *
+ *
* @version $Id$
* @since 1.7
*/
@@ -32,10 +32,10 @@ public class Crypt {
/**
* Encrypts a password in a crypt(3) compatible way.
- *
+ *
* A random salt and the default algorithm (currently SHA-512) are used. See
* {@link #crypt(String, String)} for details.
- *
+ *
* @param keyBytes
* The plaintext password.
* @return The hash value.
@@ -46,10 +46,10 @@ public class Crypt {
/**
* Encrypts a password in a crypt(3) compatible way.
- *
+ *
* A random salt and the default algorithm (currently SHA-512) are used. See
* {@link #crypt(String, String)} for details.
- *
+ *
* @param keyBytes
* The plaintext password.
* @param salt
@@ -72,9 +72,9 @@ public class Crypt {
/**
* Calculates the digest using the strongest crypt(3) algorithm.
- *
+ *
* A random salt and the default algorithm (currently SHA-512) are used.
- *
+ *
* @see #crypt(String, String)
* @param key
* The plaintext password.
@@ -86,7 +86,7 @@ public class Crypt {
/**
* Encrypts a password in a crypt(3) compatible way.
- *
+ *
* <p>
* The exact algorithm depends on the format of the salt string:
* <ul>
@@ -98,12 +98,12 @@ public class Crypt {
* </ul>
* The magic strings "$apr1$" and "$2a$" are not recognised by this method as its output should be identical with
* that of the libc implementation.
- *
+ *
* <p>
* The rest of the salt string is drawn from the set [a-zA-Z0-9./] and is cut at the maximum length of if a "$" sign
* is encountered. It is therefore valid to enter a complete hash value as salt to e.g. verify a password with:
* storedPwd.equals(crypt(enteredPwd, storedPwd))
- *
+ *
* <p>
* The resulting string starts with the marker string ($6$), continues with the salt value and ends with a "$" sign
* followed by the actual hash value. For DES the string only contains the salt and actual hash. It's toal length is
@@ -114,18 +114,18 @@ public class Crypt {
* <li>MD5: 34 chars
* <li>DES: 13 chars
* </ul>
- *
+ *
* <p>
* Example:
- *
+ *
* <pre>
* crypt("secret", "$1$xxxx") => "$1$xxxx$aMkevjfEIpa35Bh3G4bAc."
* crypt("secret", "xx") => "xxWAum7tHdIUw"
* </pre>
- *
+ *
* This method comes in a variation that accepts a byte[] array to support input strings that are not encoded in
* UTF-8 but e.g. in ISO-8859-1 where equal characters result in different byte values.
- *
+ *
* @see "The man page of the libc crypt (3) function."
* @param key
* The plaintext password as entered by the used.
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -27,7 +27,7 @@ import org.apache.commons.codec.binary.S
/**
* Operations to simplify common {@link java.security.MessageDigest} tasks. This class is thread safe.
- *
+ *
* @version $Id$
*/
public class DigestUtils {
@@ -36,7 +36,7 @@ public class DigestUtils {
/**
* Read through an InputStream and returns the digest for the data
- *
+ *
* @param digest
* The MessageDigest to use (e.g. MD5)
* @param data
@@ -59,7 +59,7 @@ public class DigestUtils {
/**
* Calls {@link StringUtils#getBytesUtf8(String)}
- *
+ *
* @param data
* the String to encode
* @return encoded bytes
@@ -70,7 +70,7 @@ public class DigestUtils {
/**
* Returns a <code>MessageDigest</code> for the given <code>algorithm</code>.
- *
+ *
* @param algorithm
* the name of the algorithm requested. See <a
* href="http://java.sun.com/j2se/1.3/docs/guide/security/CryptoSpec.html#AppA">Appendix A in the Java
@@ -91,7 +91,7 @@ public class DigestUtils {
/**
* Returns an MD5 MessageDigest.
- *
+ *
* @return An MD5 digest instance.
* @throws RuntimeException
* when a {@link java.security.NoSuchAlgorithmException} is caught.
@@ -105,7 +105,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @return An SHA-256 digest instance.
* @throws RuntimeException
* when a {@link java.security.NoSuchAlgorithmException} is caught.
@@ -119,7 +119,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @return An SHA-384 digest instance.
* @throws RuntimeException
* when a {@link java.security.NoSuchAlgorithmException} is caught.
@@ -133,7 +133,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @return An SHA-512 digest instance.
* @throws RuntimeException
* when a {@link java.security.NoSuchAlgorithmException} is caught.
@@ -144,7 +144,7 @@ public class DigestUtils {
/**
* Returns an SHA-1 digest.
- *
+ *
* @return An SHA-1 digest instance.
* @throws RuntimeException
* when a {@link java.security.NoSuchAlgorithmException} is caught.
@@ -155,7 +155,7 @@ public class DigestUtils {
/**
* Calculates the MD5 digest and returns the value as a 16 element <code>byte[]</code>.
- *
+ *
* @param data
* Data to digest
* @return MD5 digest
@@ -166,7 +166,7 @@ public class DigestUtils {
/**
* Calculates the MD5 digest and returns the value as a 16 element <code>byte[]</code>.
- *
+ *
* @param data
* Data to digest
* @return MD5 digest
@@ -180,7 +180,7 @@ public class DigestUtils {
/**
* Calculates the MD5 digest and returns the value as a 16 element <code>byte[]</code>.
- *
+ *
* @param data
* Data to digest
* @return MD5 digest
@@ -191,7 +191,7 @@ public class DigestUtils {
/**
* Calculates the MD5 digest and returns the value as a 32 character hex string.
- *
+ *
* @param data
* Data to digest
* @return MD5 digest as a hex string
@@ -202,7 +202,7 @@ public class DigestUtils {
/**
* Calculates the MD5 digest and returns the value as a 32 character hex string.
- *
+ *
* @param data
* Data to digest
* @return MD5 digest as a hex string
@@ -216,7 +216,7 @@ public class DigestUtils {
/**
* Calculates the MD5 digest and returns the value as a 32 character hex string.
- *
+ *
* @param data
* Data to digest
* @return MD5 digest as a hex string
@@ -227,7 +227,7 @@ public class DigestUtils {
/**
* Calculates the SHA-1 digest and returns the value as a <code>byte[]</code>.
- *
+ *
* @param data
* Data to digest
* @return SHA-1 digest
@@ -238,7 +238,7 @@ public class DigestUtils {
/**
* Calculates the SHA-1 digest and returns the value as a <code>byte[]</code>.
- *
+ *
* @param data
* Data to digest
* @return SHA-1 digest
@@ -252,7 +252,7 @@ public class DigestUtils {
/**
* Calculates the SHA-1 digest and returns the value as a <code>byte[]</code>.
- *
+ *
* @param data
* Data to digest
* @return SHA-1 digest
@@ -266,7 +266,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-256 digest
@@ -281,7 +281,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-256 digest
@@ -298,7 +298,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-256 digest
@@ -313,7 +313,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-256 digest as a hex string
@@ -328,7 +328,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-256 digest as a hex string
@@ -345,7 +345,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-256 digest as a hex string
@@ -360,7 +360,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-384 digest
@@ -375,7 +375,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-384 digest
@@ -392,7 +392,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-384 digest
@@ -407,7 +407,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-384 digest as a hex string
@@ -422,7 +422,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-384 digest as a hex string
@@ -439,7 +439,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-384 digest as a hex string
@@ -454,7 +454,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-512 digest
@@ -469,7 +469,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-512 digest
@@ -486,7 +486,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-512 digest
@@ -501,7 +501,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-512 digest as a hex string
@@ -516,7 +516,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-512 digest as a hex string
@@ -533,7 +533,7 @@ public class DigestUtils {
* <p>
* Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
* </p>
- *
+ *
* @param data
* Data to digest
* @return SHA-512 digest as a hex string
@@ -545,7 +545,7 @@ public class DigestUtils {
/**
* Calculates the SHA-1 digest and returns the value as a hex string.
- *
+ *
* @param data
* Data to digest
* @return SHA-1 digest as a hex string
@@ -556,7 +556,7 @@ public class DigestUtils {
/**
* Calculates the SHA-1 digest and returns the value as a hex string.
- *
+ *
* @param data
* Data to digest
* @return SHA-1 digest as a hex string
@@ -570,7 +570,7 @@ public class DigestUtils {
/**
* Calculates the SHA-1 digest and returns the value as a hex string.
- *
+ *
* @param data
* Data to digest
* @return SHA-1 digest as a hex string
@@ -581,7 +581,7 @@ public class DigestUtils {
/**
* Updates the given {@link MessageDigest}.
- *
+ *
* @param messageDigest
* the {@link MessageDigest} to update
* @param valueToDigest
@@ -596,7 +596,7 @@ public class DigestUtils {
/**
* Updates the given {@link MessageDigest}.
- *
+ *
* @param messageDigest
* the {@link MessageDigest} to update
* @param valueToDigest
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java Wed Jun 20 19:04:08 2012
@@ -38,9 +38,9 @@ import org.apache.commons.codec.Charsets
* <p>
* The C style comments are from the original C code, the ones with "//" from the port.
* </p>
- *
+ *
* <p>This class is immutable and thread-safe.</p>
- *
+ *
* @version $Id$
* @since 1.7
*/
@@ -92,10 +92,10 @@ public class Md5Crypt {
/**
* Generates an Apache htpasswd compatible "$apr1$" MD5 based hash value. *
- *
+ *
* The algorithm is identical to the crypt(3) "$1$" one but produces different outputs due to the different salt
* prefix.
- *
+ *
* @param keyBytes
* The plaintext string that should be hashed.
* @param salt
@@ -108,7 +108,7 @@ public class Md5Crypt {
/**
* Generates a libc6 crypt() compatible "$1$" hash value.
- *
+ *
* See {@link Crypt#crypt(String, String)} for details.
*/
public static String md5Crypt(final byte[] keyBytes) throws Exception {
@@ -117,9 +117,9 @@ public class Md5Crypt {
/**
* Generates a libc crypt() compatible "$1$" MD5 based hash value.
- *
+ *
* See {@link Crypt#crypt(String, String)} for details.
- *
+ *
* @param keyBytes
* The plaintext string that should be hashed.
* @param salt
@@ -132,7 +132,7 @@ public class Md5Crypt {
/**
* Generates a libc6 crypt() "$1$" or Apache htpasswd "$apr1$" hash value.
- *
+ *
* See {@link Crypt#crypt(String, String)} or {@link #apr1Crypt(String, String)} for details.
*/
public static String md5Crypt(final byte[] keyBytes, final String salt, final String prefix) throws Exception {
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java Wed Jun 20 19:04:08 2012
@@ -23,19 +23,19 @@ import java.util.regex.Pattern;
/**
* SHA2-based Unix crypt implementation.
- *
+ *
* <p>
* Based on the C implementation released into the Public Domain by Ulrich Drepper <drepper@redhat.com>
* http://www.akkadia.org/drepper/SHA-crypt.txt
* </p>
- *
+ *
* <p>
* Conversion to Kotlin and from there to Java in 2012 by Christian Hammers <ch@lathspell.de> and likewise put
* into the Public Domain.
* </p>
- *
+ *
* <p>This class is immutable and thread-safe.</p>
- *
+ *
* @version $Id$
* @since 1.7
*/
@@ -45,46 +45,46 @@ public class Sha2Crypt {
* Default number of rounds if not explicitly specified.
*/
private static final int ROUNDS_DEFAULT = 5000;
-
+
/**
* Maximum number of rounds.
*/
private static final int ROUNDS_MAX = 999999999;
-
+
/**
* Minimum number of rounds.
*/
private static final int ROUNDS_MIN = 1000;
-
+
/**
* Prefix for optional rounds specification.
*/
private static final String ROUNDS_PREFIX = "rounds=";
-
+
/**
* The MessageDigest algorithm.
*/
private static final String SHA256_ALGORITHM = "SHA-256";
-
+
/**
* The number of bytes the final hash value will have.
*/
private static final int SHA256_BLOCKSIZE = 32;
-
+
/**
* The prefixes that can be used to identify this crypt() variant.
*/
static final String SHA256_PREFIX = "$5$";
-
+
private static final String SHA512_ALGORITHM = "SHA-512";
-
+
private static final int SHA512_BLOCKSIZE = 64;
-
+
static final String SHA512_PREFIX = "$6$";
/**
* Generates a libc crypt() compatible "$5$" hash value with random salt.
- *
+ *
* See {@link Crypt#crypt(String, String)} for details.
*/
public static String sha256Crypt(byte[] keyBytes) throws Exception {
@@ -93,7 +93,7 @@ public class Sha2Crypt {
/**
* Generates a libc6 crypt() compatible "$5$" hash value.
- *
+ *
* See {@link Crypt#crypt(String, String)} for details.
*/
public static String sha256Crypt(byte[] keyBytes, String salt) throws Exception {
@@ -105,12 +105,12 @@ public class Sha2Crypt {
/**
* Generates a libc6 crypt() compatible "$5$" or "$6$" SHA2 based hash value.
- *
+ *
* This is a nearly line by line conversion of the original C function. The numbered comments are from the algorithm
* description, the short C-style ones from the original C code and the ones with "Remark" from me.
- *
+ *
* See {@link Crypt#crypt(String, String)} for details.
- *
+ *
* @param keyBytes
* The plaintext that should be hashed.
* @param salt_string
@@ -494,7 +494,7 @@ public class Sha2Crypt {
/**
* Generates a libc crypt() compatible "$6$" hash value with random salt.
- *
+ *
* See {@link Crypt#crypt(String, String)} for details.
*/
public static String sha512Crypt(byte[] keyBytes) throws Exception {
@@ -503,7 +503,7 @@ public class Sha2Crypt {
/**
* Generates a libc6 crypt() compatible "$6$" hash value.
- *
+ *
* See {@link Crypt#crypt(String, String)} for details.
*/
public static String sha512Crypt(byte[] keyBytes, String salt) throws Exception {
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/UnixCrypt.java Wed Jun 20 19:04:08 2012
@@ -55,7 +55,7 @@ public class UnixCrypt {
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 0, 0, 0, 0, 0
};
-
+
private static final int COV2CHAR[] = {
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 65, 66, 67, 68, 69, 70, 71, 72,
@@ -65,14 +65,14 @@ public class UnixCrypt {
109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
119, 120, 121, 122
};
-
+
private static final char SALT_CHARS[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./".toCharArray();
-
+
private static final boolean SHIFT2[] = {
false, false, true, true, true, true, true, true, false, true,
true, true, true, true, true, false
};
-
+
private static final int SKB[][] = {
{
0, 16, 0x20000000, 0x20000010, 0x10000, 0x10010, 0x20010000, 0x20010010, 2048, 2064,
@@ -140,7 +140,7 @@ public class UnixCrypt {
10274, 0x4002822, 0x42822, 0x4042822
}
};
-
+
private static final int SPTRANS[][] = {
{
0x820200, 0x20000, 0x80800000, 0x80820200, 0x800000, 0x80020200, 0x80020000, 0x80800000, 0x80020200, 0x820200,
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/AbstractCaverphone.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -22,12 +22,12 @@ import org.apache.commons.codec.StringEn
/**
* Encodes a string into a Caverphone value.
- *
+ *
* This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0
* algorithm:
- *
+ *
* <p>This class is immutable and thread-safe.</p>
- *
+ *
* @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $
* @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a>
* @since 1.5
@@ -44,7 +44,7 @@ public abstract class AbstractCaverphone
/**
* Encodes an Object using the caverphone algorithm. This method is provided in order to satisfy the requirements of
* the Encoder interface, and will throw an EncoderException if the supplied object is not of type java.lang.String.
- *
+ *
* @param source
* Object to encode
* @return An object (or type java.lang.String) containing the caverphone code which corresponds to the String
@@ -62,9 +62,9 @@ public abstract class AbstractCaverphone
/**
* Tests if the encodings of two strings are equal.
- *
+ *
* This method might be promoted to a new AbstractStringEncoder superclass.
- *
+ *
* @param str1
* First of two strings to compare
* @param str2
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -22,10 +22,10 @@ import org.apache.commons.codec.StringEn
/**
* Encodes a string into a Caverphone 2.0 value. Delegate to a {@link Caverphone2} instance.
- *
+ *
* This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0
* algorithm:
- *
+ *
* @version $Id: Caverphone.java 1079535 2011-03-08 20:54:37Z ggregory $
* @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a>
* @see <a href="http://caversham.otago.ac.nz/files/working/ctp150804.pdf">Caverphone 2.0 specification</a>
@@ -49,7 +49,7 @@ public class Caverphone implements Strin
/**
* Encodes the given String into a Caverphone value.
- *
+ *
* @param source
* String the source string
* @return A caverphone code for the given String
@@ -61,7 +61,7 @@ public class Caverphone implements Strin
/**
* Encodes an Object using the caverphone algorithm. This method is provided in order to satisfy the requirements of
* the Encoder interface, and will throw an EncoderException if the supplied object is not of type java.lang.String.
- *
+ *
* @param obj
* Object to encode
* @return An object (or type java.lang.String) containing the caverphone code which corresponds to the String
@@ -79,7 +79,7 @@ public class Caverphone implements Strin
/**
* Encodes a String using the Caverphone algorithm.
- *
+ *
* @param str
* String object to encode
* @return The caverphone code corresponding to the String supplied
@@ -91,7 +91,7 @@ public class Caverphone implements Strin
/**
* Tests if the caverphones of two strings are identical.
- *
+ *
* @param str1
* First of two strings to compare
* @param str2
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone1.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -19,15 +19,15 @@ package org.apache.commons.codec.languag
/**
* Encodes a string into a Caverphone 1.0 value.
- *
+ *
* This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 1.0
* algorithm:
- *
+ *
* @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $
* @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a>
* @see <a href="http://caversham.otago.ac.nz/files/working/ctp060902.pdf">Caverphone 1.0 specification</a>
* @since 1.5
- *
+ *
* <p>This class is immutable and thread-safe.</p>
*/
public class Caverphone1 extends AbstractCaverphone {
@@ -36,7 +36,7 @@ public class Caverphone1 extends Abstrac
/**
* Encodes the given String into a Caverphone value.
- *
+ *
* @param source
* String the source string
* @return A caverphone code for the given String
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/Caverphone2.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -19,15 +19,15 @@ package org.apache.commons.codec.languag
/**
* Encodes a string into a Caverphone 2.0 value.
- *
+ *
* This is an algorithm created by the Caversham Project at the University of Otago. It implements the Caverphone 2.0
* algorithm:
- *
+ *
* @version $Id: Caverphone.java 1075947 2011-03-01 17:56:14Z ggregory $
* @see <a href="http://en.wikipedia.org/wiki/Caverphone">Wikipedia - Caverphone</a>
* @see <a href="http://caversham.otago.ac.nz/files/working/ctp150804.pdf">Caverphone 2.0 specification</a>
* @since 1.5
- *
+ *
* <p>This class is immutable and thread-safe.</p>
*/
public class Caverphone2 extends AbstractCaverphone {
@@ -36,7 +36,7 @@ public class Caverphone2 extends Abstrac
/**
* Encodes the given String into a Caverphone 2.0 value.
- *
+ *
* @param source
* String the source string
* @return A caverphone code for the given String
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java?rev=1352268&r1=1352267&r2=1352268&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java Wed Jun 20 19:04:08 2012
@@ -5,9 +5,9 @@
* The ASF licenses this file to You 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.
@@ -30,16 +30,16 @@ import org.apache.commons.codec.StringEn
* Implements the <a href="http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik">Kölner Phonetik</a> (Cologne Phonetic)
* algorithm issued by Hans Joachim Postel in 1969.
* </p>
- *
+ *
* <p>
* The <i>Kölner Phonetik</i> is a phonetic algorithm which is optimized for the German language. It is related to the
* well-known soundex algorithm.
* </p>
- *
+ *
* <h2>Algorithm</h2>
- *
+ *
* <ul>
- *
+ *
* <li>
* <h3>Step 1:</h3>
* After preprocessing (conversion to upper case, transcription of <a
@@ -58,7 +58,7 @@ import org.apache.commons.codec.StringEn
* <td align="center">0</td>
* </tr>
* <tr>
- *
+ *
* <td>H</td>
* <td></td>
* <td align="center">-</td>
@@ -71,7 +71,7 @@ import org.apache.commons.codec.StringEn
* <tr>
* <td>P</td>
* <td>not before H</td>
- *
+ *
* </tr>
* <tr>
* <td>D, T</td>
@@ -84,7 +84,7 @@ import org.apache.commons.codec.StringEn
* <td rowspan="2" align="center">3</td>
* </tr>
* <tr>
- *
+ *
* <td>P</td>
* <td>before H</td>
* </tr>
@@ -96,7 +96,7 @@ import org.apache.commons.codec.StringEn
* <tr>
* <td rowspan="2">C</td>
* <td>at onset before A, H, K, L, O, Q, R, U, X</td>
- *
+ *
* </tr>
* <tr>
* <td>before A, H, K, O, Q, U, X except after S, Z</td>
@@ -109,7 +109,7 @@ import org.apache.commons.codec.StringEn
* <tr>
* <td>L</td>
* <td></td>
- *
+ *
* <td align="center">5</td>
* </tr>
* <tr>
@@ -122,7 +122,7 @@ import org.apache.commons.codec.StringEn
* <td></td>
* <td align="center">7</td>
* </tr>
- *
+ *
* <tr>
* <td>S, Z</td>
* <td></td>
@@ -135,7 +135,7 @@ import org.apache.commons.codec.StringEn
* <tr>
* <td>at onset except before A, H, K, L, O, Q, R, U, X</td>
* </tr>
- *
+ *
* <tr>
* <td>not before A, H, K, O, Q, U, X</td>
* </tr>
@@ -153,31 +153,31 @@ import org.apache.commons.codec.StringEn
* <small><i>(Source: <a href= "http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik#Buchstabencodes" >Wikipedia (de):
* Kölner Phonetik -- Buchstabencodes</a>)</i></small>
* </p>
- *
+ *
* <h4>Example:</h4>
- *
+ *
* {@code "M}ü{@code ller-L}ü{@code denscheidt" => "MULLERLUDENSCHEIDT" => "6005507500206880022"}
- *
+ *
* </li>
- *
+ *
* <li>
* <h3>Step 2:</h3>
* Collapse of all multiple consecutive code digits.
* <h4>Example:</h4>
* {@code "6005507500206880022" => "6050750206802"}</li>
- *
+ *
* <li>
* <h3>Step 3:</h3>
* Removal of all codes "0" except at the beginning. This means that two or more identical consecutive digits can occur
* if they occur after removing the "0" digits.
- *
+ *
* <h4>Example:</h4>
* {@code "6050750206802" => "65752682"}</li>
- *
+ *
* </ul>
- *
+ *
* This class is thread-safe.
- *
+ *
* @see <a href="http://de.wikipedia.org/wiki/K%C3%B6lner_Phonetik">Wikipedia (de): Kölner Phonetik (in German)</a>
* @since 1.5
*/
@@ -303,7 +303,7 @@ public class ColognePhonetic implements
* <p>
* In contrast to the initial description of the algorithm, this implementation does the encoding in one pass.
* </p>
- *
+ *
* @param text
* @return the corresponding encoding according to the <i>Kölner Phonetik</i> algorithm
*/