Skip to content

Commit 6d998a1

Browse files
committed
Renamed the package private interface StringEncodings to CharacterEncodingNames and added more Javadocs.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130407 13f79535-47bb-0310-9956-ffa450edef68
1 parent c894095 commit 6d998a1

6 files changed

Lines changed: 36 additions & 22 deletions

File tree

src/java/org/apache/commons/codec/net/BCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
*
4141
* @author Apache Software Foundation
4242
* @since 1.3
43-
* @version $Id: BCodec.java,v 1.5 2004/04/13 22:46:37 ggregory Exp $
43+
* @version $Id: BCodec.java,v 1.6 2004/07/26 22:55:40 ggregory Exp $
4444
*/
4545
public class BCodec extends RFC1522Codec implements StringEncoder, StringDecoder {
4646
/**
4747
* The default charset used for string decoding and encoding.
4848
*/
49-
private String charset = StringEncodings.UTF8;
49+
private String charset = CharacterEncodingNames.UTF8;
5050

5151
/**
5252
* Default constructor.

src/java/org/apache/commons/codec/net/StringEncodings.java renamed to src/java/org/apache/commons/codec/net/CharacterEncodingNames.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,32 @@
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
15-
*/
15+
*/
1616

1717
package org.apache.commons.codec.net;
1818

1919
/**
20-
* String encodings used in this package.
20+
* Character encoding names required of every implementation of the Java platform.
21+
*
22+
* According to the Java documentation <a
23+
* href="http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc">JRE character encoding names
24+
* </a>:
25+
* <p>
26+
* <cite>Every implementation of the Java platform is required to support the following character encodings. Consult the
27+
* release documentation for your implementation to see if any other encodings are supported. </cite>
28+
* </p>
29+
*
30+
* This interface is private to the package since it perhaps would best belong in the [lang] project with other required
31+
* encoding names. As is, this interface only defines the names used in this package. Even if a similar interface is
32+
* defined in [lang], it is not forseen that [codec] would be made to depend on [lang].
2133
*
34+
* @see <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc">JRE character encoding
35+
* names </a>
2236
* @author Apache Software Foundation
23-
* @since 1.3
24-
* @version $Id: StringEncodings.java,v 1.2 2004/04/09 22:21:07 ggregory Exp $
37+
* @since 1.4
38+
* @version $Id: CharacterEncodingNames.java,v 1.1 2004/07/26 22:55:40 ggregory Exp $
2539
*/
26-
interface StringEncodings {
40+
interface CharacterEncodingNames {
2741
/**
2842
* <p>
2943
* Seven-bit ASCII, also known as ISO646-US, also known as the Basic Latin block of the Unicode character set.
@@ -33,7 +47,7 @@ interface StringEncodings {
3347
* </p>
3448
*
3549
* @see <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc">JRE character
36-
* encoding names</a>
50+
* encoding names </a>
3751
*/
3852
String US_ASCII = "US-ASCII";
3953

@@ -46,7 +60,7 @@ interface StringEncodings {
4660
* </p>
4761
*
4862
* @see <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc">JRE character
49-
* encoding names</a>
63+
* encoding names </a>
5064
*/
5165
String UTF8 = "UTF-8";
5266
}

src/java/org/apache/commons/codec/net/QCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@
4242
*
4343
* @author Apache Software Foundation
4444
* @since 1.3
45-
* @version $Id: QCodec.java,v 1.6 2004/05/24 00:24:32 ggregory Exp $
45+
* @version $Id: QCodec.java,v 1.7 2004/07/26 22:55:40 ggregory Exp $
4646
*/
4747
public class QCodec extends RFC1522Codec implements StringEncoder, StringDecoder {
4848
/**
4949
* The default charset used for string decoding and encoding.
5050
*/
51-
private String charset = StringEncodings.UTF8;
51+
private String charset = CharacterEncodingNames.UTF8;
5252

5353
/**
5454
* BitSet of printable characters as defined in RFC 1522.

src/java/org/apache/commons/codec/net/QuotedPrintableCodec.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
*
5555
* @author Apache Software Foundation
5656
* @since 1.3
57-
* @version $Id: QuotedPrintableCodec.java,v 1.7 2004/04/09 22:21:07 ggregory Exp $
57+
* @version $Id: QuotedPrintableCodec.java,v 1.8 2004/07/26 22:55:40 ggregory Exp $
5858
*/
5959
public class QuotedPrintableCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder {
6060
/**
6161
* The default charset used for string decoding and encoding.
6262
*/
63-
private String charset = StringEncodings.UTF8;
63+
private String charset = CharacterEncodingNames.UTF8;
6464

6565
/**
6666
* BitSet of printable characters as defined in RFC 1521.
@@ -276,7 +276,7 @@ public String decode(String pString, String charset) throws DecoderException, Un
276276
if (pString == null) {
277277
return null;
278278
}
279-
return new String(decode(pString.getBytes(StringEncodings.US_ASCII)), charset);
279+
return new String(decode(pString.getBytes(CharacterEncodingNames.US_ASCII)), charset);
280280
}
281281

282282
/**
@@ -382,6 +382,6 @@ public String encode(String pString, String charset) throws UnsupportedEncodingE
382382
if (pString == null) {
383383
return null;
384384
}
385-
return new String(encode(pString.getBytes(charset)), StringEncodings.US_ASCII);
385+
return new String(encode(pString.getBytes(charset)), CharacterEncodingNames.US_ASCII);
386386
}
387387
}

src/java/org/apache/commons/codec/net/RFC1522Codec.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*
4141
* @author Apache Software Foundation
4242
* @since 1.3
43-
* @version $Id: RFC1522Codec.java,v 1.2 2004/04/09 22:21:43 ggregory Exp $
43+
* @version $Id: RFC1522Codec.java,v 1.3 2004/07/26 22:55:40 ggregory Exp $
4444
*/
4545
abstract class RFC1522Codec {
4646

@@ -75,7 +75,7 @@ protected String encodeText(final String text, final String charset)
7575
buffer.append(getEncoding());
7676
buffer.append('?');
7777
byte [] rawdata = doEncoding(text.getBytes(charset));
78-
buffer.append(new String(rawdata, StringEncodings.US_ASCII));
78+
buffer.append(new String(rawdata, CharacterEncodingNames.US_ASCII));
7979
buffer.append("?=");
8080
return buffer.toString();
8181
}
@@ -123,7 +123,7 @@ protected String decodeText(final String text)
123123
}
124124
from = to + 1;
125125
to = text.indexOf("?", from);
126-
byte[] data = text.substring(from, to).getBytes(StringEncodings.US_ASCII);
126+
byte[] data = text.substring(from, to).getBytes(CharacterEncodingNames.US_ASCII);
127127
data = doDecoding(data);
128128
return new String(data, charset);
129129
}

src/java/org/apache/commons/codec/net/URLCodec.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@
4545
*
4646
* @author Apache Software Foundation
4747
* @since 1.2
48-
* @version $Id: URLCodec.java,v 1.19 2004/03/29 07:59:00 ggregory Exp $
48+
* @version $Id: URLCodec.java,v 1.20 2004/07/26 22:55:39 ggregory Exp $
4949
*/
5050
public class URLCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder {
5151

5252
/**
5353
* The default charset used for string decoding and encoding.
5454
*/
55-
protected String charset = StringEncodings.UTF8;
55+
protected String charset = CharacterEncodingNames.UTF8;
5656

5757
protected static byte ESCAPE_CHAR = '%';
5858
/**
@@ -223,7 +223,7 @@ public String encode(String pString, String charset)
223223
if (pString == null) {
224224
return null;
225225
}
226-
return new String(encode(pString.getBytes(charset)), StringEncodings.US_ASCII);
226+
return new String(encode(pString.getBytes(charset)), CharacterEncodingNames.US_ASCII);
227227
}
228228

229229

@@ -267,7 +267,7 @@ public String decode(String pString, String charset)
267267
if (pString == null) {
268268
return null;
269269
}
270-
return new String(decode(pString.getBytes(StringEncodings.US_ASCII)), charset);
270+
return new String(decode(pString.getBytes(CharacterEncodingNames.US_ASCII)), charset);
271271
}
272272

273273

0 commit comments

Comments
 (0)