You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2018/08/13 22:28:35 UTC
[2/2] httpcomponents-core git commit: Use camel-case for ivars and
param names; don't nest with else clauses unnecessarily;
comment intention of empty blocks;
use "readLen" name for local var instead of "i" or other cryptic name to hold
read length of a
Use camel-case for ivars and param names; don't nest with else clauses
unnecessarily; comment intention of empty blocks; use "readLen" name for
local var instead of "i" or other cryptic name to hold read length of a
read() API call.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/ba172b2e
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/ba172b2e
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/ba172b2e
Branch: refs/heads/4.4.x
Commit: ba172b2e7ffd8745d39be979228f9fc4013f4328
Parents: c87704d
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Aug 13 16:28:28 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Mon Aug 13 16:28:28 2018 -0600
----------------------------------------------------------------------
.../http/benchmark/BenchmarkConnection.java | 4 +-
.../protocol/ThrottlingHttpClientHandler.java | 12 +-
.../protocol/ThrottlingHttpServiceHandler.java | 12 +-
.../impl/nio/DefaultNHttpClientConnection.java | 14 +-
.../impl/nio/DefaultNHttpServerConnection.java | 14 +-
.../http/impl/nio/NHttpConnectionBase.java | 42 ++---
.../nio/reactor/SessionInputBufferImpl.java | 4 +-
.../apache/http/nio/util/ExpandableBuffer.java | 16 +-
.../apache/http/nio/util/SharedInputBuffer.java | 19 +--
.../http/nio/util/SharedOutputBuffer.java | 13 +-
.../apache/http/nio/util/SimpleInputBuffer.java | 8 +-
.../http/nio/util/SimpleOutputBuffer.java | 9 +-
.../apache/http/WritableByteChannelMock.java | 4 +-
.../http/impl/AbstractHttpClientConnection.java | 22 +--
.../http/impl/AbstractHttpServerConnection.java | 20 +--
.../http/impl/SocketHttpClientConnection.java | 18 +-
.../http/impl/SocketHttpServerConnection.java | 18 +-
.../http/impl/entity/EntityDeserializer.java | 18 +-
.../impl/io/AbstractSessionInputBuffer.java | 128 +++++++-------
.../impl/io/AbstractSessionOutputBuffer.java | 12 +-
.../apache/http/impl/io/HttpRequestParser.java | 4 +-
.../apache/http/impl/io/HttpResponseParser.java | 4 +-
.../apache/http/impl/io/SocketInputBuffer.java | 6 +-
.../apache/http/impl/io/SocketOutputBuffer.java | 6 +-
.../apache/http/impl/BHttpConnectionBase.java | 38 ++---
.../http/impl/DefaultBHttpClientConnection.java | 14 +-
.../http/impl/DefaultBHttpServerConnection.java | 14 +-
.../http/impl/io/AbstractMessageParser.java | 16 +-
.../apache/http/impl/io/ChunkedInputStream.java | 17 +-
.../http/impl/io/ContentLengthInputStream.java | 10 +-
.../http/impl/io/DefaultHttpRequestParser.java | 4 +-
.../http/impl/io/DefaultHttpResponseParser.java | 4 +-
.../http/impl/io/IdentityInputStream.java | 15 +-
.../http/impl/io/SessionInputBufferImpl.java | 144 ++++++++--------
.../http/impl/io/SessionOutputBufferImpl.java | 12 +-
.../test/java/org/apache/http/TestHttpHost.java | 4 +-
.../java/org/apache/http/TestHttpVersion.java | 4 +-
.../http/impl/SessionInputBufferMock.java | 20 +--
.../http/impl/SessionOutputBufferMock.java | 8 +-
.../impl/io/TestContentLengthInputStream.java | 10 +-
.../apache/http/impl/io/TestRequestParser.java | 12 +-
.../apache/http/impl/io/TestResponseParser.java | 12 +-
.../http/impl/io/TestSessionInOutBuffers.java | 170 +++++++++----------
.../apache/http/message/TestBufferedHeader.java | 4 +-
.../org/apache/http/message/TestHeader.java | 4 +-
.../apache/http/message/TestHeaderGroup.java | 4 +-
.../apache/http/message/TestRequestLine.java | 4 +-
.../org/apache/http/message/TestStatusLine.java | 4 +-
.../LoggingBHttpClientConnection.java | 8 +-
.../LoggingBHttpServerConnection.java | 8 +-
.../apache/http/util/TestByteArrayBuffer.java | 4 +-
.../apache/http/util/TestCharArrayBuffer.java | 4 +-
52 files changed, 489 insertions(+), 510 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkConnection.java b/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkConnection.java
index 5b695b8..3e99307 100644
--- a/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkConnection.java
+++ b/httpcore-ab/src/main/java/org/apache/http/benchmark/BenchmarkConnection.java
@@ -48,8 +48,8 @@ class BenchmarkConnection extends DefaultBHttpClientConnection {
}
@Override
- protected InputStream createInputStream(final long len, final SessionInputBuffer inbuffer) {
- return new CountingInputStream(super.createInputStream(len, inbuffer), this.stats);
+ protected InputStream createInputStream(final long len, final SessionInputBuffer inBuffer) {
+ return new CountingInputStream(super.createInputStream(len, inBuffer), this.stats);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
index a624b7d..1825ee0 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpClientHandler.java
@@ -580,7 +580,7 @@ public class ThrottlingHttpClientHandler extends NHttpHandlerBase
public static final int RESPONSE_BODY_DONE = 64;
public static final int RESPONSE_DONE = 64;
- private final SharedInputBuffer inbuffer;
+ private final SharedInputBuffer inBuffer;
private final SharedOutputBuffer outbuffer;
private volatile int inputState;
@@ -598,14 +598,14 @@ public class ThrottlingHttpClientHandler extends NHttpHandlerBase
final IOControl ioControl,
final ByteBufferAllocator allocator) {
super();
- this.inbuffer = new SharedInputBuffer(bufsize, ioControl, allocator);
+ this.inBuffer = new SharedInputBuffer(bufsize, ioControl, allocator);
this.outbuffer = new SharedOutputBuffer(bufsize, ioControl, allocator);
this.inputState = READY;
this.outputState = READY;
}
public ContentInputBuffer getInbuffer() {
- return this.inbuffer;
+ return this.inBuffer;
}
public ContentOutputBuffer getOutbuffer() {
@@ -661,21 +661,21 @@ public class ThrottlingHttpClientHandler extends NHttpHandlerBase
}
public void close() {
- this.inbuffer.close();
+ this.inBuffer.close();
this.outbuffer.close();
this.inputState = SHUTDOWN;
this.outputState = SHUTDOWN;
}
public void shutdown() {
- this.inbuffer.shutdown();
+ this.inBuffer.shutdown();
this.outbuffer.shutdown();
this.inputState = SHUTDOWN;
this.outputState = SHUTDOWN;
}
public void resetInput() {
- this.inbuffer.reset();
+ this.inBuffer.reset();
this.request = null;
this.inputState = READY;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
index 2b9eb64..6cb1699 100644
--- a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/ThrottlingHttpServiceHandler.java
@@ -642,7 +642,7 @@ public class ThrottlingHttpServiceHandler extends NHttpHandlerBase
public static final int RESPONSE_BODY_DONE = 32;
public static final int RESPONSE_DONE = 32;
- private final SharedInputBuffer inbuffer;
+ private final SharedInputBuffer inBuffer;
private final SharedOutputBuffer outbuffer;
private volatile int inputState;
@@ -658,14 +658,14 @@ public class ThrottlingHttpServiceHandler extends NHttpHandlerBase
final IOControl ioControl,
final ByteBufferAllocator allocator) {
super();
- this.inbuffer = new SharedInputBuffer(bufsize, ioControl, allocator);
+ this.inBuffer = new SharedInputBuffer(bufsize, ioControl, allocator);
this.outbuffer = new SharedOutputBuffer(bufsize, ioControl, allocator);
this.inputState = READY;
this.outputState = READY;
}
public ContentInputBuffer getInbuffer() {
- return this.inbuffer;
+ return this.inBuffer;
}
public ContentOutputBuffer getOutbuffer() {
@@ -713,21 +713,21 @@ public class ThrottlingHttpServiceHandler extends NHttpHandlerBase
}
public void close() {
- this.inbuffer.close();
+ this.inBuffer.close();
this.outbuffer.close();
this.inputState = SHUTDOWN;
this.outputState = SHUTDOWN;
}
public void shutdown() {
- this.inbuffer.shutdown();
+ this.inBuffer.shutdown();
this.outbuffer.shutdown();
this.inputState = SHUTDOWN;
this.outputState = SHUTDOWN;
}
public void resetInput() {
- this.inbuffer.reset();
+ this.inBuffer.reset();
this.request = null;
this.inputState = READY;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
index d79dff4..4bbab09 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpClientConnection.java
@@ -105,7 +105,7 @@ public class DefaultNHttpClientConnection
* Creates new instance DefaultNHttpClientConnection given the underlying I/O session.
*
* @param session the underlying I/O session.
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
@@ -125,7 +125,7 @@ public class DefaultNHttpClientConnection
*/
public DefaultNHttpClientConnection(
final IOSession session,
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
final CharsetDecoder chardecoder,
@@ -135,7 +135,7 @@ public class DefaultNHttpClientConnection
final ContentLengthStrategy outgoingContentStrategy,
final NHttpMessageWriterFactory<HttpRequest> requestWriterFactory,
final NHttpMessageParserFactory<HttpResponse> responseParserFactory) {
- super(session, buffersize, fragmentSizeHint, allocator, chardecoder, charencoder,
+ super(session, bufferSize, fragmentSizeHint, allocator, chardecoder, charencoder,
constraints, incomingContentStrategy, outgoingContentStrategy);
this.requestWriter = (requestWriterFactory != null ? requestWriterFactory :
DefaultHttpRequestWriterFactory.INSTANCE).create(this.outbuf);
@@ -148,19 +148,19 @@ public class DefaultNHttpClientConnection
*/
public DefaultNHttpClientConnection(
final IOSession session,
- final int buffersize,
+ final int bufferSize,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final MessageConstraints constraints) {
- this(session, buffersize, buffersize, null, chardecoder, charencoder, constraints,
+ this(session, bufferSize, bufferSize, null, chardecoder, charencoder, constraints,
null, null, null, null);
}
/**
* @since 4.3
*/
- public DefaultNHttpClientConnection(final IOSession session, final int buffersize) {
- this(session, buffersize, buffersize, null, null, null, null, null, null, null, null);
+ public DefaultNHttpClientConnection(final IOSession session, final int bufferSize) {
+ this(session, bufferSize, bufferSize, null, null, null, null, null, null, null, null);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
index 258a321..cef68f1 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/DefaultNHttpServerConnection.java
@@ -105,7 +105,7 @@ public class DefaultNHttpServerConnection
* Creates new instance DefaultNHttpServerConnection given the underlying I/O session.
*
* @param session the underlying I/O session.
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
@@ -129,7 +129,7 @@ public class DefaultNHttpServerConnection
*/
public DefaultNHttpServerConnection(
final IOSession session,
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
final CharsetDecoder chardecoder,
@@ -139,7 +139,7 @@ public class DefaultNHttpServerConnection
final ContentLengthStrategy outgoingContentStrategy,
final NHttpMessageParserFactory<HttpRequest> requestParserFactory,
final NHttpMessageWriterFactory<HttpResponse> responseWriterFactory) {
- super(session, buffersize, fragmentSizeHint, allocator, chardecoder, charencoder,
+ super(session, bufferSize, fragmentSizeHint, allocator, chardecoder, charencoder,
constraints,
incomingContentStrategy != null ? incomingContentStrategy :
DisallowIdentityContentLengthStrategy.INSTANCE,
@@ -156,19 +156,19 @@ public class DefaultNHttpServerConnection
*/
public DefaultNHttpServerConnection(
final IOSession session,
- final int buffersize,
+ final int bufferSize,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final MessageConstraints constraints) {
- this(session, buffersize, buffersize, null, chardecoder, charencoder, constraints,
+ this(session, bufferSize, bufferSize, null, chardecoder, charencoder, constraints,
null, null, null, null);
}
/**
* @since 4.3
*/
- public DefaultNHttpServerConnection(final IOSession session, final int buffersize) {
- this(session, buffersize, buffersize, null, null, null, null, null, null, null, null);
+ public DefaultNHttpServerConnection(final IOSession session, final int bufferSize) {
+ this(session, bufferSize, bufferSize, null, null, null, null, null, null, null, null);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
index 0420d9e..faa9da9 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
@@ -138,13 +138,13 @@ public class NHttpConnectionBase
Args.notNull(session, "I/O session");
Args.notNull(params, "HTTP params");
- int buffersize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
- if (buffersize <= 0) {
- buffersize = 4096;
+ int bufferSize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
+ if (bufferSize <= 0) {
+ bufferSize = 4096;
}
- int linebuffersize = buffersize;
- if (linebuffersize > 512) {
- linebuffersize = 512;
+ int linebufferSize = bufferSize;
+ if (linebufferSize > 512) {
+ linebufferSize = 512;
}
CharsetDecoder decoder = null;
@@ -162,9 +162,9 @@ public class NHttpConnectionBase
decoder.onMalformedInput(malformedCharAction).onUnmappableCharacter(unmappableCharAction);
encoder.onMalformedInput(malformedCharAction).onUnmappableCharacter(unmappableCharAction);
}
- this.inbuf = new SessionInputBufferImpl(buffersize, linebuffersize, decoder, allocator);
- this.outbuf = new SessionOutputBufferImpl(buffersize, linebuffersize, encoder, allocator);
- this.fragmentSizeHint = buffersize;
+ this.inbuf = new SessionInputBufferImpl(bufferSize, linebufferSize, decoder, allocator);
+ this.outbuf = new SessionOutputBufferImpl(bufferSize, linebufferSize, encoder, allocator);
+ this.fragmentSizeHint = bufferSize;
this.constraints = MessageConstraints.DEFAULT;
this.incomingContentStrategy = createIncomingContentStrategy();
@@ -184,7 +184,7 @@ public class NHttpConnectionBase
* Creates new instance NHttpConnectionBase given the underlying I/O session.
*
* @param session the underlying I/O session.
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
@@ -204,7 +204,7 @@ public class NHttpConnectionBase
*/
protected NHttpConnectionBase(
final IOSession session,
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
final CharsetDecoder chardecoder,
@@ -213,14 +213,14 @@ public class NHttpConnectionBase
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
Args.notNull(session, "I/O session");
- Args.positive(buffersize, "Buffer size");
- int linebuffersize = buffersize;
- if (linebuffersize > 512) {
- linebuffersize = 512;
+ Args.positive(bufferSize, "Buffer size");
+ int linebufferSize = bufferSize;
+ if (linebufferSize > 512) {
+ linebufferSize = 512;
}
- this.inbuf = new SessionInputBufferImpl(buffersize, linebuffersize, chardecoder, allocator);
- this.outbuf = new SessionOutputBufferImpl(buffersize, linebuffersize, charencoder, allocator);
- this.fragmentSizeHint = fragmentSizeHint >= 0 ? fragmentSizeHint : buffersize;
+ this.inbuf = new SessionInputBufferImpl(bufferSize, linebufferSize, chardecoder, allocator);
+ this.outbuf = new SessionOutputBufferImpl(bufferSize, linebufferSize, charencoder, allocator);
+ this.fragmentSizeHint = fragmentSizeHint >= 0 ? fragmentSizeHint : bufferSize;
this.inTransportMetrics = new HttpTransportMetricsImpl();
this.outTransportMetrics = new HttpTransportMetricsImpl();
@@ -239,7 +239,7 @@ public class NHttpConnectionBase
* Creates new instance NHttpConnectionBase given the underlying I/O session.
*
* @param session the underlying I/O session.
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param allocator memory allocator.
* If {@code null} {@link org.apache.http.nio.util.HeapByteBufferAllocator#INSTANCE}
@@ -257,14 +257,14 @@ public class NHttpConnectionBase
*/
protected NHttpConnectionBase(
final IOSession session,
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final ByteBufferAllocator allocator,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
- this(session, buffersize, fragmentSizeHint, allocator, chardecoder, charencoder,
+ this(session, bufferSize, fragmentSizeHint, allocator, chardecoder, charencoder,
null, incomingContentStrategy, outgoingContentStrategy);
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
index 635677c..d93f224 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java
@@ -150,9 +150,9 @@ public class SessionInputBufferImpl extends ExpandableBuffer implements SessionI
@Deprecated
public SessionInputBufferImpl(
final int bufferSize,
- final int linebuffersize,
+ final int linebufferSize,
final HttpParams params) {
- this(bufferSize, linebuffersize, HeapByteBufferAllocator.INSTANCE, params);
+ this(bufferSize, linebufferSize, HeapByteBufferAllocator.INSTANCE, params);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java
index 71f2dac..0c71b70 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java
@@ -56,14 +56,14 @@ public class ExpandableBuffer implements BufferInfo, org.apache.http.nio.util.Bu
/**
* Allocates buffer of the given size using the given allocator.
*
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param allocator allocator to be used to allocate {@link ByteBuffer}s.
*/
- public ExpandableBuffer(final int buffersize, final ByteBufferAllocator allocator) {
+ public ExpandableBuffer(final int bufferSize, final ByteBufferAllocator allocator) {
super();
Args.notNull(allocator, "ByteBuffer allocator");
this.allocator = allocator;
- this.buffer = allocator.allocate(buffersize);
+ this.buffer = allocator.allocate(bufferSize);
this.mode = INPUT_MODE;
}
@@ -117,8 +117,8 @@ public class ExpandableBuffer implements BufferInfo, org.apache.http.nio.util.Bu
* @throws BufferOverflowException in case we get over the maximum allowed value
*/
protected void expand() throws BufferOverflowException {
- int newcapacity = (this.buffer.capacity() + 1) << 1;
- if (newcapacity < 0) {
+ int newCapacity = (this.buffer.capacity() + 1) << 1;
+ if (newCapacity < 0) {
final int vmBytes = Long.SIZE >> 3;
final int javaBytes = 8; // this is to be checked when the JVM version changes
@SuppressWarnings("unused") // we really need the 8 if we're going to make this foolproof
@@ -131,13 +131,13 @@ public class ExpandableBuffer implements BufferInfo, org.apache.http.nio.util.Bu
//
// WARNING: This code assumes you are providing enough heap room with -Xmx.
// source of inspiration: https://bugs.openjdk.java.net/browse/JDK-8059914
- newcapacity = Integer.MAX_VALUE - headRoom;
+ newCapacity = Integer.MAX_VALUE - headRoom;
- if (newcapacity <= this.buffer.capacity()) {
+ if (newCapacity <= this.buffer.capacity()) {
throw new BufferOverflowException();
}
}
- expandCapacity(newcapacity);
+ expandCapacity(newCapacity);
}
/**
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
index 3d7723e..72aa021 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
@@ -66,8 +66,8 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
* @deprecated (4.3) use {@link SharedInputBuffer#SharedInputBuffer(int, ByteBufferAllocator)}
*/
@Deprecated
- public SharedInputBuffer(final int buffersize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
- super(buffersize, allocator);
+ public SharedInputBuffer(final int bufferSize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
+ super(bufferSize, allocator);
this.ioctrl = ioctrl;
this.lock = new ReentrantLock();
this.condition = this.lock.newCondition();
@@ -76,8 +76,8 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
/**
* @since 4.3
*/
- public SharedInputBuffer(final int buffersize, final ByteBufferAllocator allocator) {
- super(buffersize, allocator);
+ public SharedInputBuffer(final int bufferSize, final ByteBufferAllocator allocator) {
+ super(bufferSize, allocator);
this.lock = new ReentrantLock();
this.condition = this.lock.newCondition();
}
@@ -85,8 +85,8 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
/**
* @since 4.3
*/
- public SharedInputBuffer(final int buffersize) {
- this(buffersize, HeapByteBufferAllocator.INSTANCE);
+ public SharedInputBuffer(final int bufferSize) {
+ this(bufferSize, HeapByteBufferAllocator.INSTANCE);
}
@Override
@@ -142,13 +142,8 @@ public class SharedInputBuffer extends ExpandableBuffer implements ContentInputB
if (totalRead > 0) {
return totalRead;
- } else {
- if (this.endOfStream) {
- return -1;
- } else {
- return 0;
- }
}
+ return this.endOfStream ? -1 : 0;
} finally {
this.lock.unlock();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
index 9bcccd5..98b8a75 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
@@ -68,8 +68,8 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
* @deprecated (4.3) use {@link SharedOutputBuffer#SharedOutputBuffer(int, ByteBufferAllocator)}
*/
@Deprecated
- public SharedOutputBuffer(final int buffersize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
- super(buffersize, allocator);
+ public SharedOutputBuffer(final int bufferSize, final IOControl ioctrl, final ByteBufferAllocator allocator) {
+ super(bufferSize, allocator);
Args.notNull(ioctrl, "I/O content control");
this.ioctrl = ioctrl;
this.lock = new ReentrantLock();
@@ -79,8 +79,8 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
/**
* @since 4.3
*/
- public SharedOutputBuffer(final int buffersize, final ByteBufferAllocator allocator) {
- super(buffersize, allocator);
+ public SharedOutputBuffer(final int bufferSize, final ByteBufferAllocator allocator) {
+ super(bufferSize, allocator);
this.lock = new ReentrantLock();
this.condition = this.lock.newCondition();
}
@@ -88,8 +88,8 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
/**
* @since 4.3
*/
- public SharedOutputBuffer(final int buffersize) {
- this(buffersize, HeapByteBufferAllocator.INSTANCE);
+ public SharedOutputBuffer(final int bufferSize) {
+ this(bufferSize, HeapByteBufferAllocator.INSTANCE);
}
@Override
@@ -263,6 +263,7 @@ public class SharedOutputBuffer extends ExpandableBuffer implements ContentOutpu
@Override
public void flush() throws IOException {
+ // do nothing.
}
private void flushContent() throws IOException {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java
index ed352e4..834bdad 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleInputBuffer.java
@@ -41,15 +41,15 @@ public class SimpleInputBuffer extends ExpandableBuffer implements ContentInputB
private boolean endOfStream = false;
- public SimpleInputBuffer(final int buffersize, final ByteBufferAllocator allocator) {
- super(buffersize, allocator);
+ public SimpleInputBuffer(final int bufferSize, final ByteBufferAllocator allocator) {
+ super(bufferSize, allocator);
}
/**
* @since 4.3
*/
- public SimpleInputBuffer(final int buffersize) {
- this(buffersize, HeapByteBufferAllocator.INSTANCE);
+ public SimpleInputBuffer(final int bufferSize) {
+ this(bufferSize, HeapByteBufferAllocator.INSTANCE);
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java b/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java
index d3416d2..b1080fc 100644
--- a/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java
+++ b/httpcore-nio/src/main/java/org/apache/http/nio/util/SimpleOutputBuffer.java
@@ -41,16 +41,16 @@ public class SimpleOutputBuffer extends ExpandableBuffer implements ContentOutpu
private boolean endOfStream;
- public SimpleOutputBuffer(final int buffersize, final ByteBufferAllocator allocator) {
- super(buffersize, allocator);
+ public SimpleOutputBuffer(final int bufferSize, final ByteBufferAllocator allocator) {
+ super(bufferSize, allocator);
this.endOfStream = false;
}
/**
* @since 4.3
*/
- public SimpleOutputBuffer(final int buffersize) {
- this(buffersize, HeapByteBufferAllocator.INSTANCE);
+ public SimpleOutputBuffer(final int bufferSize) {
+ this(bufferSize, HeapByteBufferAllocator.INSTANCE);
}
@Override
@@ -104,6 +104,7 @@ public class SimpleOutputBuffer extends ExpandableBuffer implements ContentOutpu
@Override
public void flush() {
+ // do nothing.
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore-nio/src/test/java/org/apache/http/WritableByteChannelMock.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/test/java/org/apache/http/WritableByteChannelMock.java b/httpcore-nio/src/test/java/org/apache/http/WritableByteChannelMock.java
index b519306..35d4d8d 100644
--- a/httpcore-nio/src/test/java/org/apache/http/WritableByteChannelMock.java
+++ b/httpcore-nio/src/test/java/org/apache/http/WritableByteChannelMock.java
@@ -43,8 +43,8 @@ public class WritableByteChannelMock implements WritableByteChannel {
private final int capacityLimit;
private int curCapacity;
- public InternalBuffer(final int buffersize, final int capacityLimit) {
- super(buffersize, HeapByteBufferAllocator.INSTANCE);
+ public InternalBuffer(final int bufferSize, final int capacityLimit) {
+ super(bufferSize, HeapByteBufferAllocator.INSTANCE);
this.capacityLimit = capacityLimit;
this.curCapacity = capacityLimit;
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
index fecec64..6f2b816 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpClientConnection.java
@@ -77,7 +77,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
private final EntitySerializer entityserializer;
private final EntityDeserializer entitydeserializer;
- private SessionInputBuffer inbuffer = null;
+ private SessionInputBuffer inBuffer = null;
private SessionOutputBuffer outbuffer = null;
private EofSensor eofSensor = null;
private HttpMessageParser<HttpResponse> responseParser = null;
@@ -212,27 +212,27 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
* methods to initialize HTTP request writer and response parser for this
* connection.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param outbuffer the session output buffer.
* @param params HTTP parameters.
*/
protected void init(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final SessionOutputBuffer outbuffer,
final HttpParams params) {
- this.inbuffer = Args.notNull(inbuffer, "Input session buffer");
+ this.inBuffer = Args.notNull(inBuffer, "Input session buffer");
this.outbuffer = Args.notNull(outbuffer, "Output session buffer");
- if (inbuffer instanceof EofSensor) {
- this.eofSensor = (EofSensor) inbuffer;
+ if (inBuffer instanceof EofSensor) {
+ this.eofSensor = (EofSensor) inBuffer;
}
this.responseParser = createResponseParser(
- inbuffer,
+ inBuffer,
createHttpResponseFactory(),
params);
this.requestWriter = createRequestWriter(
outbuffer, params);
this.metrics = createConnectionMetrics(
- inbuffer.getMetrics(),
+ inBuffer.getMetrics(),
outbuffer.getMetrics());
}
@@ -240,7 +240,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
public boolean isResponseAvailable(final int timeout) throws IOException {
assertOpen();
try {
- return this.inbuffer.isDataAvailable(timeout);
+ return this.inBuffer.isDataAvailable(timeout);
} catch (final SocketTimeoutException ex) {
return false;
}
@@ -295,7 +295,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
throws HttpException, IOException {
Args.notNull(response, "HTTP response");
assertOpen();
- final HttpEntity entity = this.entitydeserializer.deserialize(this.inbuffer, response);
+ final HttpEntity entity = this.entitydeserializer.deserialize(this.inBuffer, response);
response.setEntity(entity);
}
@@ -312,7 +312,7 @@ public abstract class AbstractHttpClientConnection implements HttpClientConnecti
return true;
}
try {
- this.inbuffer.isDataAvailable(1);
+ this.inBuffer.isDataAvailable(1);
return isEof();
} catch (final SocketTimeoutException ex) {
return false;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
index 28465a4..04cef17 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/AbstractHttpServerConnection.java
@@ -76,7 +76,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
private final EntitySerializer entityserializer;
private final EntityDeserializer entitydeserializer;
- private SessionInputBuffer inbuffer = null;
+ private SessionInputBuffer inBuffer = null;
private SessionOutputBuffer outbuffer = null;
private EofSensor eofSensor = null;
private HttpMessageParser<HttpRequest> requestParser = null;
@@ -212,27 +212,27 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
* methods to initialize HTTP request parser and response writer for this
* connection.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param outbuffer the session output buffer.
* @param params HTTP parameters.
*/
protected void init(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final SessionOutputBuffer outbuffer,
final HttpParams params) {
- this.inbuffer = Args.notNull(inbuffer, "Input session buffer");
+ this.inBuffer = Args.notNull(inBuffer, "Input session buffer");
this.outbuffer = Args.notNull(outbuffer, "Output session buffer");
- if (inbuffer instanceof EofSensor) {
- this.eofSensor = (EofSensor) inbuffer;
+ if (inBuffer instanceof EofSensor) {
+ this.eofSensor = (EofSensor) inBuffer;
}
this.requestParser = createRequestParser(
- inbuffer,
+ inBuffer,
createHttpRequestFactory(),
params);
this.responseWriter = createResponseWriter(
outbuffer, params);
this.metrics = createConnectionMetrics(
- inbuffer.getMetrics(),
+ inBuffer.getMetrics(),
outbuffer.getMetrics());
}
@@ -250,7 +250,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
throws HttpException, IOException {
Args.notNull(request, "HTTP request");
assertOpen();
- final HttpEntity entity = this.entitydeserializer.deserialize(this.inbuffer, request);
+ final HttpEntity entity = this.entitydeserializer.deserialize(this.inBuffer, request);
request.setEntity(entity);
}
@@ -300,7 +300,7 @@ public abstract class AbstractHttpServerConnection implements HttpServerConnecti
return true;
}
try {
- this.inbuffer.isDataAvailable(1);
+ this.inBuffer.isDataAvailable(1);
return isEof();
} catch (final IOException ex) {
return true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
index 0d98a88..ac0d97e 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpClientConnection.java
@@ -83,16 +83,16 @@ public class SocketHttpClientConnection
* @see SocketInputBuffer#SocketInputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session input buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionInputBuffer createSessionInputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketInputBuffer(socket, buffersize, params);
+ return new SocketInputBuffer(socket, bufferSize, params);
}
/**
@@ -105,16 +105,16 @@ public class SocketHttpClientConnection
* @see SocketOutputBuffer#SocketOutputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session output buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketOutputBuffer(socket, buffersize, params);
+ return new SocketOutputBuffer(socket, bufferSize, params);
}
/**
@@ -142,10 +142,10 @@ public class SocketHttpClientConnection
Args.notNull(params, "HTTP parameters");
this.socket = socket;
- final int buffersize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
+ final int bufferSize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
init(
- createSessionInputBuffer(socket, buffersize, params),
- createSessionOutputBuffer(socket, buffersize, params),
+ createSessionInputBuffer(socket, bufferSize, params),
+ createSessionOutputBuffer(socket, bufferSize, params),
params);
this.open = true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
index c343058..dcf190c 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/SocketHttpServerConnection.java
@@ -74,16 +74,16 @@ public class SocketHttpServerConnection extends
* @see SocketInputBuffer#SocketInputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session input buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionInputBuffer createSessionInputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketInputBuffer(socket, buffersize, params);
+ return new SocketInputBuffer(socket, bufferSize, params);
}
/**
@@ -96,16 +96,16 @@ public class SocketHttpServerConnection extends
* @see SocketOutputBuffer#SocketOutputBuffer(Socket, int, HttpParams)
*
* @param socket the socket.
- * @param buffersize the buffer size.
+ * @param bufferSize the buffer size.
* @param params HTTP parameters.
* @return session output buffer.
* @throws IOException in case of an I/O error.
*/
protected SessionOutputBuffer createSessionOutputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
- return new SocketOutputBuffer(socket, buffersize, params);
+ return new SocketOutputBuffer(socket, bufferSize, params);
}
/**
@@ -131,10 +131,10 @@ public class SocketHttpServerConnection extends
Args.notNull(params, "HTTP parameters");
this.socket = socket;
- final int buffersize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
+ final int bufferSize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
init(
- createSessionInputBuffer(socket, buffersize, params),
- createSessionOutputBuffer(socket, buffersize, params),
+ createSessionInputBuffer(socket, bufferSize, params),
+ createSessionOutputBuffer(socket, bufferSize, params),
params);
this.open = true;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
index f9c8f51..f538e5d 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/entity/EntityDeserializer.java
@@ -82,14 +82,14 @@ public class EntityDeserializer {
* This method is called by the public
* {@link #deserialize(SessionInputBuffer, HttpMessage)}.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param message the message.
* @return HTTP entity.
* @throws HttpException in case of HTTP protocol violation.
* @throws IOException in case of an I/O error.
*/
protected BasicHttpEntity doDeserialize(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final HttpMessage message) throws HttpException, IOException {
final BasicHttpEntity entity = new BasicHttpEntity();
@@ -97,15 +97,15 @@ public class EntityDeserializer {
if (len == ContentLengthStrategy.CHUNKED) {
entity.setChunked(true);
entity.setContentLength(-1);
- entity.setContent(new ChunkedInputStream(inbuffer));
+ entity.setContent(new ChunkedInputStream(inBuffer));
} else if (len == ContentLengthStrategy.IDENTITY) {
entity.setChunked(false);
entity.setContentLength(-1);
- entity.setContent(new IdentityInputStream(inbuffer));
+ entity.setContent(new IdentityInputStream(inBuffer));
} else {
entity.setChunked(false);
entity.setContentLength(len);
- entity.setContent(new ContentLengthInputStream(inbuffer, len));
+ entity.setContent(new ContentLengthInputStream(inBuffer, len));
}
final Header contentTypeHeader = message.getFirstHeader(HTTP.CONTENT_TYPE);
@@ -127,18 +127,18 @@ public class EntityDeserializer {
* <p>
* The content of the entity is NOT retrieved by this method.
*
- * @param inbuffer the session input buffer.
+ * @param inBuffer the session input buffer.
* @param message the message.
* @return HTTP entity.
* @throws HttpException in case of HTTP protocol violation.
* @throws IOException in case of an I/O error.
*/
public HttpEntity deserialize(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final HttpMessage message) throws HttpException, IOException {
- Args.notNull(inbuffer, "Session input buffer");
+ Args.notNull(inBuffer, "Session input buffer");
Args.notNull(message, "HTTP message");
- return doDeserialize(inbuffer, message);
+ return doDeserialize(inBuffer, message);
}
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
index 6ce8018..533a233 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java
@@ -64,9 +64,9 @@ import org.apache.http.util.CharArrayBuffer;
@Deprecated
public abstract class AbstractSessionInputBuffer implements SessionInputBuffer, BufferInfo {
- private InputStream instream;
+ private InputStream inStream;
private byte[] buffer;
- private ByteArrayBuffer linebuffer;
+ private ByteArrayBuffer lineBuffer;
private Charset charset;
private boolean ascii;
private int maxLineLen;
@@ -75,8 +75,8 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
private CodingErrorAction onMalformedCharAction;
private CodingErrorAction onUnmappableCharAction;
- private int bufferpos;
- private int bufferlen;
+ private int bufferPos;
+ private int bufferLen;
private CharsetDecoder decoder;
private CharBuffer cbuf;
@@ -86,19 +86,19 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
/**
* Initializes this session input buffer.
*
- * @param instream the source input stream.
- * @param buffersize the size of the internal buffer.
+ * @param inputStream the source input stream.
+ * @param bufferSize the size of the internal buffer.
* @param params HTTP parameters.
*/
- protected void init(final InputStream instream, final int buffersize, final HttpParams params) {
- Args.notNull(instream, "Input stream");
- Args.notNegative(buffersize, "Buffer size");
+ protected void init(final InputStream inputStream, final int bufferSize, final HttpParams params) {
+ Args.notNull(inputStream, "Input stream");
+ Args.notNegative(bufferSize, "Buffer size");
Args.notNull(params, "HTTP parameters");
- this.instream = instream;
- this.buffer = new byte[buffersize];
- this.bufferpos = 0;
- this.bufferlen = 0;
- this.linebuffer = new ByteArrayBuffer(buffersize);
+ this.inStream = inputStream;
+ this.buffer = new byte[bufferSize];
+ this.bufferPos = 0;
+ this.bufferLen = 0;
+ this.lineBuffer = new ByteArrayBuffer(bufferSize);
final String charset = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
this.charset = charset != null ? Charset.forName(charset) : Consts.ASCII;
this.ascii = this.charset.equals(Consts.ASCII);
@@ -134,7 +134,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
*/
@Override
public int length() {
- return this.bufferlen - this.bufferpos;
+ return this.bufferLen - this.bufferPos;
}
/**
@@ -147,29 +147,28 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
protected int fillBuffer() throws IOException {
// compact the buffer if necessary
- if (this.bufferpos > 0) {
- final int len = this.bufferlen - this.bufferpos;
+ if (this.bufferPos > 0) {
+ final int len = this.bufferLen - this.bufferPos;
if (len > 0) {
- System.arraycopy(this.buffer, this.bufferpos, this.buffer, 0, len);
+ System.arraycopy(this.buffer, this.bufferPos, this.buffer, 0, len);
}
- this.bufferpos = 0;
- this.bufferlen = len;
+ this.bufferPos = 0;
+ this.bufferLen = len;
}
- final int l;
- final int off = this.bufferlen;
+ final int readLen;
+ final int off = this.bufferLen;
final int len = this.buffer.length - off;
- l = this.instream.read(this.buffer, off, len);
- if (l == -1) {
+ readLen = this.inStream.read(this.buffer, off, len);
+ if (readLen == -1) {
return -1;
- } else {
- this.bufferlen = off + l;
- this.metrics.incrementBytesTransferred(l);
- return l;
}
+ this.bufferLen = off + readLen;
+ this.metrics.incrementBytesTransferred(readLen);
+ return readLen;
}
protected boolean hasBufferedData() {
- return this.bufferpos < this.bufferlen;
+ return this.bufferPos < this.bufferLen;
}
@Override
@@ -181,7 +180,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
return -1;
}
}
- return this.buffer[this.bufferpos++] & 0xff;
+ return this.buffer[this.bufferPos++] & 0xff;
}
@Override
@@ -190,32 +189,31 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
return 0;
}
if (hasBufferedData()) {
- final int chunk = Math.min(len, this.bufferlen - this.bufferpos);
- System.arraycopy(this.buffer, this.bufferpos, b, off, chunk);
- this.bufferpos += chunk;
+ final int chunk = Math.min(len, this.bufferLen - this.bufferPos);
+ System.arraycopy(this.buffer, this.bufferPos, b, off, chunk);
+ this.bufferPos += chunk;
return chunk;
}
// If the remaining capacity is big enough, read directly from the
// underlying input stream bypassing the buffer.
if (len > this.minChunkLimit) {
- final int read = this.instream.read(b, off, len);
+ final int read = this.inStream.read(b, off, len);
if (read > 0) {
this.metrics.incrementBytesTransferred(read);
}
return read;
- } else {
- // otherwise read to the buffer first
- while (!hasBufferedData()) {
- final int noRead = fillBuffer();
- if (noRead == -1) {
- return -1;
- }
+ }
+ // otherwise read to the buffer first
+ while (!hasBufferedData()) {
+ final int noRead = fillBuffer();
+ if (noRead == -1) {
+ return -1;
}
- final int chunk = Math.min(len, this.bufferlen - this.bufferpos);
- System.arraycopy(this.buffer, this.bufferpos, b, off, chunk);
- this.bufferpos += chunk;
- return chunk;
}
+ final int chunk = Math.min(len, this.bufferLen - this.bufferPos);
+ System.arraycopy(this.buffer, this.bufferPos, b, off, chunk);
+ this.bufferPos += chunk;
+ return chunk;
}
@Override
@@ -227,7 +225,7 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
}
private int locateLF() {
- for (int i = this.bufferpos; i < this.bufferlen; i++) {
+ for (int i = this.bufferPos; i < this.bufferLen; i++) {
if (this.buffer[i] == HTTP.LF) {
return i;
}
@@ -260,31 +258,31 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
final int i = locateLF();
if (i != -1) {
// end of line found.
- if (this.linebuffer.isEmpty()) {
+ if (this.lineBuffer.isEmpty()) {
// the entire line is preset in the read buffer
return lineFromReadBuffer(charbuffer, i);
}
retry = false;
- final int len = i + 1 - this.bufferpos;
- this.linebuffer.append(this.buffer, this.bufferpos, len);
- this.bufferpos = i + 1;
+ final int len = i + 1 - this.bufferPos;
+ this.lineBuffer.append(this.buffer, this.bufferPos, len);
+ this.bufferPos = i + 1;
} else {
// end of line not found
if (hasBufferedData()) {
- final int len = this.bufferlen - this.bufferpos;
- this.linebuffer.append(this.buffer, this.bufferpos, len);
- this.bufferpos = this.bufferlen;
+ final int len = this.bufferLen - this.bufferPos;
+ this.lineBuffer.append(this.buffer, this.bufferPos, len);
+ this.bufferPos = this.bufferLen;
}
noRead = fillBuffer();
if (noRead == -1) {
retry = false;
}
}
- if (this.maxLineLen > 0 && this.linebuffer.length() >= this.maxLineLen) {
+ if (this.maxLineLen > 0 && this.lineBuffer.length() >= this.maxLineLen) {
throw new IOException("Maximum line length limit exceeded");
}
}
- if (noRead == -1 && this.linebuffer.isEmpty()) {
+ if (noRead == -1 && this.lineBuffer.isEmpty()) {
// indicate the end of stream
return -1;
}
@@ -307,33 +305,33 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
private int lineFromLineBuffer(final CharArrayBuffer charbuffer)
throws IOException {
// discard LF if found
- int len = this.linebuffer.length();
+ int len = this.lineBuffer.length();
if (len > 0) {
- if (this.linebuffer.byteAt(len - 1) == HTTP.LF) {
+ if (this.lineBuffer.byteAt(len - 1) == HTTP.LF) {
len--;
}
// discard CR if found
if (len > 0) {
- if (this.linebuffer.byteAt(len - 1) == HTTP.CR) {
+ if (this.lineBuffer.byteAt(len - 1) == HTTP.CR) {
len--;
}
}
}
if (this.ascii) {
- charbuffer.append(this.linebuffer, 0, len);
+ charbuffer.append(this.lineBuffer, 0, len);
} else {
- final ByteBuffer bbuf = ByteBuffer.wrap(this.linebuffer.buffer(), 0, len);
+ final ByteBuffer bbuf = ByteBuffer.wrap(this.lineBuffer.buffer(), 0, len);
len = appendDecoded(charbuffer, bbuf);
}
- this.linebuffer.clear();
+ this.lineBuffer.clear();
return len;
}
private int lineFromReadBuffer(final CharArrayBuffer charbuffer, final int position)
throws IOException {
- final int off = this.bufferpos;
+ final int off = this.bufferPos;
int i = position;
- this.bufferpos = i + 1;
+ this.bufferPos = i + 1;
if (i > off && this.buffer[i - 1] == HTTP.CR) {
// skip CR if found
i--;
@@ -392,8 +390,8 @@ public abstract class AbstractSessionInputBuffer implements SessionInputBuffer,
@Override
public String readLine() throws IOException {
final CharArrayBuffer charbuffer = new CharArrayBuffer(64);
- final int l = readLine(charbuffer);
- if (l != -1) {
+ final int readLen = readLine(charbuffer);
+ if (readLen != -1) {
return charbuffer.toString();
} else {
return null;
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
index 38c14de..177bb47 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java
@@ -79,16 +79,16 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
protected AbstractSessionOutputBuffer(
final OutputStream outstream,
- final int buffersize,
+ final int bufferSize,
final Charset charset,
final int minChunkLimit,
final CodingErrorAction malformedCharAction,
final CodingErrorAction unmappableCharAction) {
super();
Args.notNull(outstream, "Input stream");
- Args.notNegative(buffersize, "Buffer size");
+ Args.notNegative(bufferSize, "Buffer size");
this.outstream = outstream;
- this.buffer = new ByteArrayBuffer(buffersize);
+ this.buffer = new ByteArrayBuffer(bufferSize);
this.charset = charset != null ? charset : Consts.ASCII;
this.ascii = this.charset.equals(Consts.ASCII);
this.encoder = null;
@@ -103,12 +103,12 @@ public abstract class AbstractSessionOutputBuffer implements SessionOutputBuffer
public AbstractSessionOutputBuffer() {
}
- protected void init(final OutputStream outstream, final int buffersize, final HttpParams params) {
+ protected void init(final OutputStream outstream, final int bufferSize, final HttpParams params) {
Args.notNull(outstream, "Input stream");
- Args.notNegative(buffersize, "Buffer size");
+ Args.notNegative(bufferSize, "Buffer size");
Args.notNull(params, "HTTP parameters");
this.outstream = outstream;
- this.buffer = new ByteArrayBuffer(buffersize);
+ this.buffer = new ByteArrayBuffer(bufferSize);
final String charset = (String) params.getParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET);
this.charset = charset != null ? Charset.forName(charset) : Consts.ASCII;
this.ascii = this.charset.equals(Consts.ASCII);
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
index 5337fb5..553719b 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpRequestParser.java
@@ -88,8 +88,8 @@ public class HttpRequestParser extends AbstractMessageParser<HttpMessage> {
throws IOException, HttpException, ParseException {
this.lineBuf.clear();
- final int i = sessionBuffer.readLine(this.lineBuf);
- if (i == -1) {
+ final int readLen = sessionBuffer.readLine(this.lineBuf);
+ if (readLen == -1) {
throw new ConnectionClosedException("Client closed connection");
}
final ParserCursor cursor = new ParserCursor(0, this.lineBuf.length());
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
index 0b6399b..e61fbd6 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/HttpResponseParser.java
@@ -88,8 +88,8 @@ public class HttpResponseParser extends AbstractMessageParser<HttpMessage> {
throws IOException, HttpException, ParseException {
this.lineBuf.clear();
- final int i = sessionBuffer.readLine(this.lineBuf);
- if (i == -1) {
+ final int readLen = sessionBuffer.readLine(this.lineBuf);
+ if (readLen == -1) {
throw new NoHttpResponseException("The target server failed to respond");
}
//create the status line from the status string
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
index 246ca0a..b5d8eae 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketInputBuffer.java
@@ -53,7 +53,7 @@ public class SocketInputBuffer extends AbstractSessionInputBuffer implements Eof
* Creates an instance of this class.
*
* @param socket the socket to read data from.
- * @param buffersize the size of the internal buffer. If this number is less
+ * @param bufferSize the size of the internal buffer. If this number is less
* than {@code 0} it is set to the value of
* {@link Socket#getReceiveBufferSize()}. If resultant number is less
* than {@code 1024} it is set to {@code 1024}.
@@ -61,13 +61,13 @@ public class SocketInputBuffer extends AbstractSessionInputBuffer implements Eof
*/
public SocketInputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
super();
Args.notNull(socket, "Socket");
this.socket = socket;
this.eof = false;
- int n = buffersize;
+ int n = bufferSize;
if (n < 0) {
n = socket.getReceiveBufferSize();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
index 95c63a7..4bb78e5 100644
--- a/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
+++ b/httpcore/src/main/java-deprecated/org/apache/http/impl/io/SocketOutputBuffer.java
@@ -48,7 +48,7 @@ public class SocketOutputBuffer extends AbstractSessionOutputBuffer {
* Creates an instance of this class.
*
* @param socket the socket to write data to.
- * @param buffersize the size of the internal buffer. If this number is less
+ * @param bufferSize the size of the internal buffer. If this number is less
* than {@code 0} it is set to the value of
* {@link Socket#getSendBufferSize()}. If resultant number is less
* than {@code 1024} it is set to {@code 1024}.
@@ -56,11 +56,11 @@ public class SocketOutputBuffer extends AbstractSessionOutputBuffer {
*/
public SocketOutputBuffer(
final Socket socket,
- final int buffersize,
+ final int bufferSize,
final HttpParams params) throws IOException {
super();
Args.notNull(socket, "Socket");
- int n = buffersize;
+ int n = bufferSize;
if (n < 0) {
n = socket.getSendBufferSize();
}
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java b/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
index 4176286..6a294cb 100644
--- a/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
+++ b/httpcore/src/main/java/org/apache/http/impl/BHttpConnectionBase.java
@@ -75,7 +75,7 @@ import org.apache.http.util.NetUtils;
*/
public class BHttpConnectionBase implements HttpInetConnection {
- private final SessionInputBufferImpl inbuffer;
+ private final SessionInputBufferImpl inBuffer;
private final SessionOutputBufferImpl outbuffer;
private final MessageConstraints messageConstraints;
private final HttpConnectionMetricsImpl connMetrics;
@@ -86,7 +86,7 @@ public class BHttpConnectionBase implements HttpInetConnection {
/**
* Creates new instance of BHttpConnectionBase.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
@@ -100,7 +100,7 @@ public class BHttpConnectionBase implements HttpInetConnection {
* {@link StrictContentLengthStrategy#INSTANCE} will be used.
*/
protected BHttpConnectionBase(
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
@@ -108,12 +108,12 @@ public class BHttpConnectionBase implements HttpInetConnection {
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
super();
- Args.positive(buffersize, "Buffer size");
+ Args.positive(bufferSize, "Buffer size");
final HttpTransportMetricsImpl inTransportMetrics = new HttpTransportMetricsImpl();
final HttpTransportMetricsImpl outTransportMetrics = new HttpTransportMetricsImpl();
- this.inbuffer = new SessionInputBufferImpl(inTransportMetrics, buffersize, -1,
+ this.inBuffer = new SessionInputBufferImpl(inTransportMetrics, bufferSize, -1,
messageConstraints != null ? messageConstraints : MessageConstraints.DEFAULT, chardecoder);
- this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, buffersize, fragmentSizeHint,
+ this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, bufferSize, fragmentSizeHint,
charencoder);
this.messageConstraints = messageConstraints;
this.connMetrics = new HttpConnectionMetricsImpl(inTransportMetrics, outTransportMetrics);
@@ -129,8 +129,8 @@ public class BHttpConnectionBase implements HttpInetConnection {
if (socket == null) {
throw new ConnectionClosedException();
}
- if (!this.inbuffer.isBound()) {
- this.inbuffer.bind(getSocketInputStream(socket));
+ if (!this.inBuffer.isBound()) {
+ this.inBuffer.bind(getSocketInputStream(socket));
}
if (!this.outbuffer.isBound()) {
this.outbuffer.bind(getSocketOutputStream(socket));
@@ -158,12 +158,12 @@ public class BHttpConnectionBase implements HttpInetConnection {
protected void bind(final Socket socket) throws IOException {
Args.notNull(socket, "Socket");
this.socketHolder.set(socket);
- this.inbuffer.bind(null);
+ this.inBuffer.bind(null);
this.outbuffer.bind(null);
}
protected SessionInputBuffer getSessionInputBuffer() {
- return this.inbuffer;
+ return this.inBuffer;
}
protected SessionOutputBuffer getSessionOutputBuffer() {
@@ -202,15 +202,15 @@ public class BHttpConnectionBase implements HttpInetConnection {
protected InputStream createInputStream(
final long len,
- final SessionInputBuffer inbuffer) {
+ final SessionInputBuffer inBuffer) {
if (len == ContentLengthStrategy.CHUNKED) {
- return new ChunkedInputStream(inbuffer, this.messageConstraints);
+ return new ChunkedInputStream(inBuffer, this.messageConstraints);
} else if (len == ContentLengthStrategy.IDENTITY) {
- return new IdentityInputStream(inbuffer);
+ return new IdentityInputStream(inBuffer);
} else if (len == 0L) {
return EmptyInputStream.INSTANCE;
} else {
- return new ContentLengthInputStream(inbuffer, len);
+ return new ContentLengthInputStream(inBuffer, len);
}
}
@@ -218,7 +218,7 @@ public class BHttpConnectionBase implements HttpInetConnection {
final BasicHttpEntity entity = new BasicHttpEntity();
final long len = this.incomingContentStrategy.determineLength(message);
- final InputStream instream = createInputStream(len, this.inbuffer);
+ final InputStream instream = createInputStream(len, this.inBuffer);
if (len == ContentLengthStrategy.CHUNKED) {
entity.setChunked(true);
entity.setContentLength(-1);
@@ -315,7 +315,7 @@ public class BHttpConnectionBase implements HttpInetConnection {
final Socket socket = this.socketHolder.getAndSet(null);
if (socket != null) {
try {
- this.inbuffer.clear();
+ this.inBuffer.clear();
this.outbuffer.flush();
try {
try {
@@ -340,18 +340,18 @@ public class BHttpConnectionBase implements HttpInetConnection {
final int oldtimeout = socket.getSoTimeout();
try {
socket.setSoTimeout(timeout);
- return this.inbuffer.fillBuffer();
+ return this.inBuffer.fillBuffer();
} finally {
socket.setSoTimeout(oldtimeout);
}
}
protected boolean awaitInput(final int timeout) throws IOException {
- if (this.inbuffer.hasBufferedData()) {
+ if (this.inBuffer.hasBufferedData()) {
return true;
}
fillInputBuffer(timeout);
- return this.inbuffer.hasBufferedData();
+ return this.inBuffer.hasBufferedData();
}
@Override
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
index 374da33..74ca496 100644
--- a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
+++ b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpClientConnection.java
@@ -65,7 +65,7 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
/**
* Creates new instance of DefaultBHttpClientConnection.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
@@ -83,7 +83,7 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
* {@link DefaultHttpResponseParserFactory#INSTANCE} will be used.
*/
public DefaultBHttpClientConnection(
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
@@ -92,7 +92,7 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageWriterFactory<HttpRequest> requestWriterFactory,
final HttpMessageParserFactory<HttpResponse> responseParserFactory) {
- super(buffersize, fragmentSizeHint, chardecoder, charencoder,
+ super(bufferSize, fragmentSizeHint, chardecoder, charencoder,
constraints, incomingContentStrategy, outgoingContentStrategy);
this.requestWriter = (requestWriterFactory != null ? requestWriterFactory :
DefaultHttpRequestWriterFactory.INSTANCE).create(getSessionOutputBuffer());
@@ -101,15 +101,15 @@ public class DefaultBHttpClientConnection extends BHttpConnectionBase
}
public DefaultBHttpClientConnection(
- final int buffersize,
+ final int bufferSize,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final MessageConstraints constraints) {
- this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
+ this(bufferSize, bufferSize, chardecoder, charencoder, constraints, null, null, null, null);
}
- public DefaultBHttpClientConnection(final int buffersize) {
- this(buffersize, buffersize, null, null, null, null, null, null, null);
+ public DefaultBHttpClientConnection(final int bufferSize) {
+ this(bufferSize, bufferSize, null, null, null, null, null, null, null);
}
protected void onResponseReceived(final HttpResponse response) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
index 85b46b7..e9f2ea0 100644
--- a/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
+++ b/httpcore/src/main/java/org/apache/http/impl/DefaultBHttpServerConnection.java
@@ -63,7 +63,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
/**
* Creates new instance of DefaultBHttpServerConnection.
*
- * @param buffersize buffer size. Must be a positive number.
+ * @param bufferSize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If {@code null} simple type cast will be used for byte to char conversion.
@@ -81,7 +81,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
* {@link DefaultHttpResponseWriterFactory#INSTANCE} will be used.
*/
public DefaultBHttpServerConnection(
- final int buffersize,
+ final int bufferSize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
@@ -90,7 +90,7 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
final ContentLengthStrategy outgoingContentStrategy,
final HttpMessageParserFactory<HttpRequest> requestParserFactory,
final HttpMessageWriterFactory<HttpResponse> responseWriterFactory) {
- super(buffersize, fragmentSizeHint, chardecoder, charencoder, constraints,
+ super(bufferSize, fragmentSizeHint, chardecoder, charencoder, constraints,
incomingContentStrategy != null ? incomingContentStrategy :
DisallowIdentityContentLengthStrategy.INSTANCE, outgoingContentStrategy);
this.requestParser = (requestParserFactory != null ? requestParserFactory :
@@ -100,15 +100,15 @@ public class DefaultBHttpServerConnection extends BHttpConnectionBase implements
}
public DefaultBHttpServerConnection(
- final int buffersize,
+ final int bufferSize,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final MessageConstraints constraints) {
- this(buffersize, buffersize, chardecoder, charencoder, constraints, null, null, null, null);
+ this(bufferSize, bufferSize, chardecoder, charencoder, constraints, null, null, null, null);
}
- public DefaultBHttpServerConnection(final int buffersize) {
- this(buffersize, buffersize, null, null, null, null, null, null, null);
+ public DefaultBHttpServerConnection(final int bufferSize) {
+ this(bufferSize, bufferSize, null, null, null, null, null, null, null);
}
protected void onRequestReceived(final HttpRequest request) {
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java b/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
index 9dc9c92..72a7878 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
@@ -119,7 +119,7 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* Parses HTTP headers from the data receiver stream according to the generic
* format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3.
*
- * @param inbuffer Session input buffer
+ * @param inBuffer Session input buffer
* @param maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
* IOException will be thrown. Setting this parameter to a negative value
@@ -135,12 +135,12 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* @throws HttpException in case of HTTP protocol violation
*/
public static Header[] parseHeaders(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final int maxHeaderCount,
final int maxLineLen,
final LineParser parser) throws HttpException, IOException {
final List<CharArrayBuffer> headerLines = new ArrayList<CharArrayBuffer>();
- return parseHeaders(inbuffer, maxHeaderCount, maxLineLen,
+ return parseHeaders(inBuffer, maxHeaderCount, maxLineLen,
parser != null ? parser : BasicLineParser.INSTANCE,
headerLines);
}
@@ -149,7 +149,7 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* Parses HTTP headers from the data receiver stream according to the generic
* format as given in Section 3.1 of RFC 822, RFC-2616 Section 4 and 19.3.
*
- * @param inbuffer Session input buffer
+ * @param inBuffer Session input buffer
* @param maxHeaderCount maximum number of headers allowed. If the number
* of headers received from the data stream exceeds maxCount value, an
* IOException will be thrown. Setting this parameter to a negative value
@@ -170,12 +170,12 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
* @since 4.1
*/
public static Header[] parseHeaders(
- final SessionInputBuffer inbuffer,
+ final SessionInputBuffer inBuffer,
final int maxHeaderCount,
final int maxLineLen,
final LineParser parser,
final List<CharArrayBuffer> headerLines) throws HttpException, IOException {
- Args.notNull(inbuffer, "Session input buffer");
+ Args.notNull(inBuffer, "Session input buffer");
Args.notNull(parser, "Line parser");
Args.notNull(headerLines, "Header line list");
@@ -187,8 +187,8 @@ public abstract class AbstractMessageParser<T extends HttpMessage> implements Ht
} else {
current.clear();
}
- final int l = inbuffer.readLine(current);
- if (l == -1 || current.length() < 1) {
+ final int readLen = inBuffer.readLine(current);
+ if (readLen == -1 || current.length() < 1) {
break;
}
// Parse the header name and value
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ba172b2e/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java b/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
index a87708a..f4f62fa 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/ChunkedInputStream.java
@@ -186,19 +186,18 @@ public class ChunkedInputStream extends InputStream {
return -1;
}
}
- final int bytesRead = in.read(b, off, (int) Math.min(len, chunkSize - pos));
- if (bytesRead != -1) {
- pos += bytesRead;
+ final int readLen = in.read(b, off, (int) Math.min(len, chunkSize - pos));
+ if (readLen != -1) {
+ pos += readLen;
if (pos >= chunkSize) {
state = CHUNK_CRLF;
}
- return bytesRead;
- } else {
- eof = true;
- throw new TruncatedChunkException("Truncated chunk "
- + "( expected size: " + chunkSize
- + "; actual size: " + pos + ")");
+ return readLen;
}
+ eof = true;
+ throw new TruncatedChunkException("Truncated chunk "
+ + "( expected size: " + chunkSize
+ + "; actual size: " + pos + ")");
}
/**