You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2002/02/15 07:27:11 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient ResponseInputStream.java
dion 02/02/14 22:27:11
Modified: httpclient/src/java/org/apache/commons/httpclient
ResponseInputStream.java
Log:
Applied patches from Sean C. Sullivan, fixed some formatting issues
Revision Changes Path
1.12 +31 -7 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java
Index: ResponseInputStream.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ResponseInputStream.java 5 Jan 2002 11:16:00 -0000 1.11
+++ ResponseInputStream.java 15 Feb 2002 06:27:11 -0000 1.12
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v 1.11 2002/01/05 11:16:00 vmassol Exp $
- * $Revision: 1.11 $
- * $Date: 2002/01/05 11:16:00 $
+ * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ResponseInputStream.java,v 1.12 2002/02/15 06:27:11 dion Exp $
+ * $Revision: 1.12 $
+ * $Date: 2002/02/15 06:27:11 $
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -70,17 +70,30 @@
* <p>{@link InputStream} wrapper supporting the chunked transfer encoding.</p>
*
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.11 $ $Date: 2002/01/05 11:16:00 $
+ * @author <a href="mailto:sean@seansullivan.com">Sean C. Sullivan</a>
+ * @author <a href="mailto:dion@apache.org">dIon Gillard</a>
+ * @version $Revision: 1.12 $ $Date: 2002/02/15 06:27:11 $
*/
public class ResponseInputStream extends InputStream {
// ----------------------------------------------------------- Constructors
+ /**
+ *
+ * @param stream Must be non-null.
+ * @param chunked <code>true</code> if the input stream is chunked
+ * @param contentLength content length
+ *
+ */
public ResponseInputStream(InputStream stream, boolean chunked, int contentLength) {
+ if (null == stream) {
+ throw new NullPointerException("InputStream parameter is null");
+ }
closed = false;
count = 0;
this.chunk = chunked;
this.contentLength = contentLength;
+ this.stream = stream;
}
/**
@@ -90,18 +103,29 @@
*/
public ResponseInputStream(InputStream stream, HttpMethod method) {
super();
+
+ if (null == stream) {
+ throw new NullPointerException("InputStream parameter is null");
+ }
+
+
+ if (null == method) {
+ throw new NullPointerException("HttpMethod parameter is null");
+ }
+
closed = false;
count = 0;
// Retrieving transfer encoding header
Header transferEncoding = method.getResponseHeader("transfer-encoding");
- if((null != transferEncoding)
- && (transferEncoding.getValue().toLowerCase().indexOf("chunked") != -1))
+ if ((null != transferEncoding) && (transferEncoding.getValue().
+ toLowerCase().indexOf("chunked") != -1)) {
chunk = true;
+ }
// Retrieving content length header
Header contentLengthHeader = method.getResponseHeader("content-length");
- if(null != contentLengthHeader) {
+ if (null != contentLengthHeader) {
try {
this.contentLength =
Integer.parseInt(contentLengthHeader.getValue());
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>