You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2007/01/23 12:52:02 UTC
svn commit: r498996 [2/2] - in
/jakarta/httpcomponents/httpcore/trunk/module-nio/src:
examples/org/apache/http/nio/examples/
main/java/org/apache/http/nio/concurrent/
main/java/org/apache/http/nio/impl/entity/
main/java/org/apache/http/nio/params/ main...
Added: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java?view=auto&rev=498996
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java (added)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java Tue Jan 23 03:52:01 2007
@@ -0,0 +1,44 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.nio.util;
+
+import java.io.IOException;
+
+public interface ContentInputBuffer {
+
+ void shutdown() throws IOException;
+
+ int read(byte[] b, int off, int len) throws IOException;
+
+ int read() throws IOException;
+
+}
Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentInputBuffer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java?view=auto&rev=498996
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java (added)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java Tue Jan 23 03:52:01 2007
@@ -0,0 +1,46 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.nio.util;
+
+import java.io.IOException;
+
+public interface ContentOutputBuffer {
+
+ void shutdown() throws IOException;
+
+ public void flush() throws IOException;
+
+ void write(byte[] b, int off, int len) throws IOException;
+
+ void write(int b) throws IOException;
+
+}
Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/ContentOutputBuffer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/InputBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/InputBuffer.java?view=diff&rev=498996&r1=498995&r2=498996
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/InputBuffer.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/InputBuffer.java Tue Jan 23 03:52:01 2007
@@ -34,7 +34,7 @@
import org.apache.http.nio.ContentDecoder;
-public class InputBuffer extends ExpandableBuffer {
+public class InputBuffer extends ExpandableBuffer implements ContentInputBuffer {
private boolean endOfStream = false;
@@ -105,4 +105,7 @@
return read(b, 0, b.length);
}
+ public void shutdown() {
+ }
+
}
Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/OutputBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/OutputBuffer.java?view=diff&rev=498996&r1=498995&r2=498996
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/OutputBuffer.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/OutputBuffer.java Tue Jan 23 03:52:01 2007
@@ -34,7 +34,7 @@
import org.apache.http.nio.ContentEncoder;
-public class OutputBuffer extends ExpandableBuffer {
+public class OutputBuffer extends ExpandableBuffer implements ContentOutputBuffer {
public OutputBuffer(int buffersize) {
super(buffersize);
@@ -65,6 +65,16 @@
setInputMode();
ensureCapacity(this.capacity() + 1);
this.buffer.put((byte)b);
+ }
+
+ public void clear() {
+ super.clear();
+ }
+
+ public void flush() {
+ }
+
+ public void shutdown() {
}
}
Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java?view=diff&rev=498996&r1=498995&r2=498996
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java Tue Jan 23 03:52:01 2007
@@ -35,14 +35,13 @@
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.ContentIOControl;
-public class SharedInputBuffer extends ExpandableBuffer {
+public class SharedInputBuffer extends ExpandableBuffer implements ContentInputBuffer {
private final ContentIOControl ioctrl;
private final Object mutex;
private volatile boolean shutdown = false;
private volatile boolean endOfStream = false;
- private volatile IOException exception = null;
public SharedInputBuffer(int buffersize, final ContentIOControl ioctrl) {
super(buffersize);
@@ -91,10 +90,6 @@
this.ioctrl.requestInput();
this.mutex.wait();
}
- IOException ex = this.exception;
- if (ex != null) {
- throw ex;
- }
} catch (InterruptedException ex) {
throw new IOException("Interrupted while waiting for more data");
}
@@ -111,11 +106,6 @@
}
}
- public void shutdown(final IOException exception) {
- this.exception = exception;
- shutdown();
- }
-
protected boolean isShutdown() {
return this.shutdown;
}
Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java?view=diff&rev=498996&r1=498995&r2=498996
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java Tue Jan 23 03:52:01 2007
@@ -35,14 +35,13 @@
import org.apache.http.nio.ContentEncoder;
import org.apache.http.nio.ContentIOControl;
-public class SharedOutputBuffer extends ExpandableBuffer {
+public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutputBuffer {
private final ContentIOControl ioctrl;
private final Object mutex;
private volatile boolean shutdown = false;
private volatile boolean endOfStream = false;
- private volatile IOException exception = null;
public SharedOutputBuffer(int buffersize, final ContentIOControl ioctrl) {
super(buffersize);
@@ -88,12 +87,6 @@
this.ioctrl.requestOutput();
this.mutex.wait();
}
-
- IOException ex = this.exception;
- if (ex != null) {
- throw ex;
- }
-
} catch (InterruptedException ex) {
throw new IOException("Interrupted while waiting for more data");
}
@@ -108,11 +101,6 @@
synchronized (this.mutex) {
this.mutex.notifyAll();
}
- }
-
- public void shutdown(final IOException exception) {
- this.exception = exception;
- shutdown();
}
public void write(final byte[] b, int off, int len) throws IOException {