Skip to content

Commit 82e6bf9

Browse files
committed
Bugzilla Bug 30864
[codec] Document how to print a QPDecoderStream with QCodec? Added Javadoc noting that arguments are expected to be String (and byte[] sometimes). Codec does not do Stream (yet). git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/codec/trunk@130412 13f79535-47bb-0310-9956-ffa450edef68
1 parent 31ce6a5 commit 82e6bf9

4 files changed

Lines changed: 38 additions & 18 deletions

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
*
4242
* @author Apache Software Foundation
4343
* @since 1.3
44-
* @version $Id: BCodec.java,v 1.7 2004/08/05 20:39:39 ggregory Exp $
44+
* @version $Id: BCodec.java,v 1.8 2004/08/27 17:10:48 ggregory Exp $
4545
*/
4646
public class BCodec extends RFC1522Codec implements StringEncoder, StringDecoder {
4747
/**
@@ -177,6 +177,11 @@ public Object encode(Object value) throws EncoderException {
177177
* Decodes a Base64 object into its original form. Escaped characters are converted back to their original
178178
* representation.
179179
*
180+
* <p>
181+
* <em>Currently, this method only works with <code>String</code> arguments.
182+
* A <code>DecoderException</code> is thrown if the argument is not a <code>String</code>.</em>
183+
* </p>
184+
*
180185
* @param value
181186
* Base64 object to convert into its original form
182187
*

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
*
4343
* @author Apache Software Foundation
4444
* @since 1.3
45-
* @version $Id: QCodec.java,v 1.7 2004/07/26 22:55:40 ggregory Exp $
45+
* @version $Id: QCodec.java,v 1.8 2004/08/27 17:10:48 ggregory Exp $
4646
*/
4747
public class QCodec extends RFC1522Codec implements StringEncoder, StringDecoder {
4848
/**
@@ -259,6 +259,12 @@ public Object encode(Object pObject) throws EncoderException {
259259
* Decodes a quoted-printable object into its original form. Escaped characters are converted back to their original
260260
* representation.
261261
*
262+
* <p>
263+
* <em>Currently, this method only works with <code>String</code> arguments.
264+
* A <code>DecoderException</code> is thrown if the argument is not a <code>String</code>.</em>
265+
* </p>
266+
*
267+
*
262268
* @param pObject
263269
* quoted-printable object to convert into its original form
264270
*

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
*
5656
* @author Apache Software Foundation
5757
* @since 1.3
58-
* @version $Id: QuotedPrintableCodec.java,v 1.9 2004/08/05 20:39:39 ggregory Exp $
58+
* @version $Id: QuotedPrintableCodec.java,v 1.10 2004/08/27 17:10:48 ggregory Exp $
5959
*/
6060
public class QuotedPrintableCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder {
6161
/**
@@ -332,6 +332,11 @@ public Object encode(Object pObject) throws EncoderException {
332332
* Decodes a quoted-printable object into its original form. Escaped characters are converted back to their original
333333
* representation.
334334
*
335+
* <p>
336+
* <em>Currently, this method only works with <code>String</code> and <code>byte[]</code> arguments.
337+
* A <code>DecoderException</code> is thrown if the argument is not a <code>String</code> or <code>byte[].</code></em>.
338+
* </p>
339+
*
335340
* @param pObject
336341
* quoted-printable object to convert into its original form
337342
* @return original object

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

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
*
4646
* @author Apache Software Foundation
4747
* @since 1.2
48-
* @version $Id: URLCodec.java,v 1.20 2004/07/26 22:55:39 ggregory Exp $
48+
* @version $Id: URLCodec.java,v 1.21 2004/08/27 17:10:48 ggregory Exp $
4949
*/
5050
public class URLCodec implements BinaryEncoder, BinaryDecoder, StringEncoder, StringDecoder {
5151

@@ -318,32 +318,36 @@ public Object encode(Object pObject) throws EncoderException {
318318
}
319319

320320
/**
321-
* Decodes a URL safe object into its original form. Escaped
322-
* characters are converted back to their original representation.
323-
*
324-
* @param pObject URL safe object to convert into its original form
325-
* @return original object
326-
* @throws DecoderException Thrown if URL decoding is not
327-
* applicable to objects of this type
328-
* if decoding is unsuccessful
321+
* Decodes a URL safe object into its original form. Escaped characters are converted back to their original
322+
* representation.
323+
*
324+
* <p>
325+
* <em>Currently, this method only works with <code>String</code> and <code>byte[]</code> arguments.
326+
* A <code>DecoderException</code> is thrown if the argument is not a <code>String</code> or <code>byte[].</code></em>.
327+
* </p>
328+
*
329+
* @param pObject
330+
* URL safe object to convert into its original form
331+
* @return original object
332+
* @throws DecoderException
333+
* Thrown if URL decoding is not applicable to objects of this type if decoding is unsuccessful
329334
*/
330335
public Object decode(Object pObject) throws DecoderException {
331336
if (pObject == null) {
332337
return null;
333338
} else if (pObject instanceof byte[]) {
334-
return decode((byte[])pObject);
339+
return decode((byte[]) pObject);
335340
} else if (pObject instanceof String) {
336-
return decode((String)pObject);
341+
return decode((String) pObject);
337342
} else {
338-
throw new DecoderException("Objects of type " +
339-
pObject.getClass().getName() + " cannot be URL decoded");
340-
343+
throw new DecoderException("Objects of type " + pObject.getClass().getName() + " cannot be URL decoded");
344+
341345
}
342346
}
343347

344348
/**
345349
* The <code>String</code> encoding used for decoding and encoding.
346-
*
350+
*
347351
* @return Returns the encoding.
348352
*
349353
* @deprecated use #getDefaultCharset()

0 commit comments

Comments
 (0)