hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r952774 - in /httpcomponents/httpcore/trunk/httpcore/src: main/java/org/apache/http/entity/InputStreamEntity.java test/java/org/apache/http/entity/TestInputStreamEntity.java
Date Tue, 08 Jun 2010 19:10:25 GMT
Author: olegk
Date: Tue Jun  8 19:10:25 2010
New Revision: 952774

URL: http://svn.apache.org/viewvc?rev=952774&view=rev
Log:
Cleaned up InputStreamEntity#isStreaming

Modified:
    httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
    httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java

Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java?rev=952774&r1=952773&r2=952774&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/entity/InputStreamEntity.java
Tue Jun  8 19:10:25 2010
@@ -43,7 +43,6 @@ public class InputStreamEntity extends A
 
     private final InputStream content;
     private final long length;
-    private boolean consumed = false;
 
     public InputStreamEntity(final InputStream instream, long length) {
         super();
@@ -90,20 +89,16 @@ public class InputStreamEntity extends A
                 remaining -= l;
             }
         }
-        this.consumed = true;
     }
 
-    // non-javadoc, see interface HttpEntity
     public boolean isStreaming() {
-        return !this.consumed;
+        return true;
     }
 
-    // non-javadoc, see interface HttpEntity
     public void consumeContent() throws IOException {
-        this.consumed = true;
         // If the input stream is from a connection, closing it will read to
         // the end of the content. Otherwise, we don't care what it does.
         this.content.close();
     }
 
-} // class InputStreamEntity
+}

Modified: httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java?rev=952774&r1=952773&r2=952774&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore/src/test/java/org/apache/http/entity/TestInputStreamEntity.java
Tue Jun  8 19:10:25 2010
@@ -86,7 +86,6 @@ public class TestInputStreamEntity exten
         bytes2 = out.toByteArray();
         assertNotNull(bytes2);
         assertEquals(bytes.length, bytes2.length);
-        assertFalse(httpentity.isStreaming());
 
         instream = new ByteArrayInputStream(bytes);
         httpentity = new InputStreamEntity(instream, -1);
@@ -95,7 +94,6 @@ public class TestInputStreamEntity exten
         bytes2 = out.toByteArray();
         assertNotNull(bytes2);
         assertEquals(bytes.length, bytes2.length);
-        assertFalse(httpentity.isStreaming());
 
         try {
             httpentity.writeTo(null);
@@ -105,15 +103,4 @@ public class TestInputStreamEntity exten
         }
     }
 
-    public void testConsume() throws Exception {
-        byte[] bytes = "Message content".getBytes(HTTP.ISO_8859_1);
-        InputStream instream = new ByteArrayInputStream(bytes);
-        InputStreamEntity httpentity = new InputStreamEntity(instream, -1);
-        assertTrue(httpentity.isStreaming());
-        httpentity.consumeContent();
-        assertFalse(httpentity.isStreaming());
-        httpentity.consumeContent();
-        assertFalse(httpentity.isStreaming());
-    }
-
 }



Mime
View raw message