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 2017/05/09 20:02:31 UTC

[02/34] httpcomponents-core git commit: Moved deprecated classes; fixed some deprecation warnings

Moved deprecated classes; fixed some deprecation warnings

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpcore/branches/4.3.x@1558081 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/6289707a
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/6289707a
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/6289707a

Branch: refs/heads/4.3.x
Commit: 6289707aa1b4b3d70bcca939481aaf32c5f7af0a
Parents: e120b58
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Tue Jan 14 15:31:55 2014 +0000
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Tue Jan 14 15:31:55 2014 +0000

----------------------------------------------------------------------
 .../http/nio/entity/BufferingNHttpEntity.java   | 123 +++++++++++++++++++
 .../entity/ConsumingNHttpEntityTemplate.java    |  91 ++++++++++++++
 .../apache/http/nio/entity/ContentListener.java |  59 +++++++++
 .../http/nio/entity/NHttpEntityWrapper.java     | 107 ++++++++++++++++
 .../http/nio/entity/SkipContentListener.java    |  69 +++++++++++
 .../impl/nio/codecs/AbstractContentEncoder.java |   4 +-
 .../http/nio/entity/BufferingNHttpEntity.java   | 123 -------------------
 .../entity/ConsumingNHttpEntityTemplate.java    |  91 --------------
 .../apache/http/nio/entity/ContentListener.java |  59 ---------
 .../http/nio/entity/NHttpEntityWrapper.java     | 107 ----------------
 .../http/nio/entity/SkipContentListener.java    |  69 -----------
 .../org/apache/http/entity/ByteArrayEntity.java |   2 +
 12 files changed, 452 insertions(+), 452 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java
new file mode 100644
index 0000000..f23a614
--- /dev/null
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/BufferingNHttpEntity.java
@@ -0,0 +1,123 @@
+/*
+ * ====================================================================
+ * 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.entity;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.entity.HttpEntityWrapper;
+import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.IOControl;
+import org.apache.http.nio.util.ByteBufferAllocator;
+import org.apache.http.nio.util.SimpleInputBuffer;
+import org.apache.http.util.Args;
+import org.apache.http.util.Asserts;
+
+/**
+ * A {@link ConsumingNHttpEntity} that consumes content into a buffer. The
+ * content can be retrieved as an InputStream via
+ * {@link HttpEntity#getContent()}, or written to an output stream via
+ * {@link HttpEntity#writeTo(OutputStream)}.
+ *
+ * @since 4.0
+ *
+ * @deprecated use (4.2)
+ *  {@link org.apache.http.nio.protocol.BasicAsyncRequestProducer}
+ *  or {@link org.apache.http.nio.protocol.BasicAsyncResponseProducer}
+ */
+@NotThreadSafe
+@Deprecated
+public class BufferingNHttpEntity extends HttpEntityWrapper implements
+        ConsumingNHttpEntity {
+
+    private final static int BUFFER_SIZE = 2048;
+
+    private final SimpleInputBuffer buffer;
+    private boolean finished;
+    private boolean consumed;
+
+    public BufferingNHttpEntity(
+            final HttpEntity httpEntity,
+            final ByteBufferAllocator allocator) {
+        super(httpEntity);
+        this.buffer = new SimpleInputBuffer(BUFFER_SIZE, allocator);
+    }
+
+    public void consumeContent(
+            final ContentDecoder decoder,
+            final IOControl ioctrl) throws IOException {
+        this.buffer.consumeContent(decoder);
+        if (decoder.isCompleted()) {
+            this.finished = true;
+        }
+    }
+
+    public void finish() {
+        this.finished = true;
+    }
+
+    /**
+     * Obtains entity's content as {@link InputStream}.
+     *
+     *  @throws IllegalStateException if content of the entity has not been
+     *    fully received or has already been consumed.
+     */
+    @Override
+    public InputStream getContent() throws IOException {
+        Asserts.check(this.finished, "Entity content has not been fully received");
+        Asserts.check(!this.consumed, "Entity content has been consumed");
+        this.consumed = true;
+        return new ContentInputStream(this.buffer);
+    }
+
+    @Override
+    public boolean isRepeatable() {
+        return false;
+    }
+
+    @Override
+    public boolean isStreaming() {
+        return true;
+    }
+
+    @Override
+    public void writeTo(final OutputStream outstream) throws IOException {
+        Args.notNull(outstream, "Output stream");
+        final InputStream instream = getContent();
+        final byte[] buff = new byte[BUFFER_SIZE];
+        int l;
+        // consume until EOF
+        while ((l = instream.read(buff)) != -1) {
+            outstream.write(buff, 0, l);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
new file mode 100644
index 0000000..6695319
--- /dev/null
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
@@ -0,0 +1,91 @@
+/*
+ * ====================================================================
+ * 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.entity;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.entity.HttpEntityWrapper;
+import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.IOControl;
+
+/**
+ * A {@link ConsumingNHttpEntity} that forwards available content to a
+ * {@link ContentListener}.
+ *
+ * @since 4.0
+ *
+ * @deprecated use (4.2)
+ *  {@link org.apache.http.nio.protocol.BasicAsyncRequestProducer}
+ *  or {@link org.apache.http.nio.protocol.BasicAsyncResponseProducer}
+ */
+@Deprecated
+public class ConsumingNHttpEntityTemplate
+    extends HttpEntityWrapper implements ConsumingNHttpEntity {
+
+    private final ContentListener contentListener;
+
+    public ConsumingNHttpEntityTemplate(
+            final HttpEntity httpEntity,
+            final ContentListener contentListener) {
+        super(httpEntity);
+        this.contentListener = contentListener;
+    }
+
+    public ContentListener getContentListener() {
+        return contentListener;
+    }
+
+    @Override
+    public InputStream getContent() throws IOException, UnsupportedOperationException {
+        throw new UnsupportedOperationException("Does not support blocking methods");
+    }
+
+    @Override
+    public boolean isStreaming() {
+        return true;
+    }
+
+    @Override
+    public void writeTo(final OutputStream out) throws IOException, UnsupportedOperationException {
+        throw new UnsupportedOperationException("Does not support blocking methods");
+    }
+
+    public void consumeContent(
+            final ContentDecoder decoder,
+            final IOControl ioctrl) throws IOException {
+        this.contentListener.contentAvailable(decoder, ioctrl);
+    }
+
+    public void finish() {
+        this.contentListener.finished();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java
new file mode 100644
index 0000000..8063bee
--- /dev/null
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/ContentListener.java
@@ -0,0 +1,59 @@
+/*
+ * ====================================================================
+ * 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.entity;
+
+import java.io.IOException;
+
+import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.IOControl;
+
+/**
+ * A listener for available data on a non-blocking {@link ConsumingNHttpEntity}.
+ *
+ * @since 4.0
+ *
+ * @deprecated (4.2)
+ */
+@Deprecated
+public interface ContentListener {
+
+    /**
+     * Notification that content is available to be read from the decoder.
+     *
+     * @param decoder content decoder.
+     * @param ioctrl I/O control of the underlying connection.
+     */
+    void contentAvailable(ContentDecoder decoder, IOControl ioctrl)
+        throws IOException;
+
+    /**
+     * Notification that any resources allocated for reading can be released.
+     */
+    void finished();
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java
new file mode 100644
index 0000000..44bc1be
--- /dev/null
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java
@@ -0,0 +1,107 @@
+/*
+ * ====================================================================
+ * 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.entity;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.entity.HttpEntityWrapper;
+import org.apache.http.nio.ContentEncoder;
+import org.apache.http.nio.IOControl;
+
+/**
+ * {@link ProducingNHttpEntity} compatibility adaptor for blocking HTTP
+ * entities.
+ *
+ * @since 4.0
+ *
+ * @deprecated (4.2) use {@link EntityAsyncContentProducer}
+ */
+@NotThreadSafe
+@Deprecated
+public class NHttpEntityWrapper
+    extends HttpEntityWrapper implements ProducingNHttpEntity {
+
+    private final ReadableByteChannel channel;
+    private final ByteBuffer buffer;
+
+    public NHttpEntityWrapper(final HttpEntity httpEntity) throws IOException {
+        super(httpEntity);
+        this.channel = Channels.newChannel(httpEntity.getContent());
+        this.buffer = ByteBuffer.allocate(4096);
+    }
+
+    /**
+     * This method throws {@link UnsupportedOperationException}.
+     */
+    @Override
+    public InputStream getContent() throws IOException, UnsupportedOperationException {
+        throw new UnsupportedOperationException("Does not support blocking methods");
+    }
+
+    @Override
+    public boolean isStreaming() {
+        return true;
+    }
+
+    /**
+     * This method throws {@link UnsupportedOperationException}.
+     */
+    @Override
+    public void writeTo(final OutputStream out) throws IOException, UnsupportedOperationException {
+        throw new UnsupportedOperationException("Does not support blocking methods");
+    }
+
+    public void produceContent(
+            final ContentEncoder encoder,
+            final IOControl ioctrl) throws IOException {
+        final int i = this.channel.read(this.buffer);
+        this.buffer.flip();
+        encoder.write(this.buffer);
+        final boolean buffering = this.buffer.hasRemaining();
+        this.buffer.compact();
+        if (i == -1 && !buffering) {
+            encoder.complete();
+            this.channel.close();
+        }
+    }
+
+    public void finish() {
+        try {
+            this.channel.close();
+        } catch (final IOException ignore) {
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java
new file mode 100644
index 0000000..ca6e93d
--- /dev/null
+++ b/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java
@@ -0,0 +1,69 @@
+/*
+ * ====================================================================
+ * 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.entity;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.apache.http.nio.ContentDecoder;
+import org.apache.http.nio.IOControl;
+import org.apache.http.nio.util.ByteBufferAllocator;
+import org.apache.http.util.Args;
+
+/**
+ * A simple {@link ContentListener} that reads and ignores all content.
+ *
+ * @since 4.0
+ *
+ * @deprecated (4.2)
+ */
+@Deprecated
+public class SkipContentListener implements ContentListener {
+
+    private final ByteBuffer buffer;
+
+    public SkipContentListener(final ByteBufferAllocator allocator) {
+        super();
+        Args.notNull(allocator, "ByteBuffer allocator");
+        this.buffer = allocator.allocate(2048);
+    }
+
+    public void contentAvailable(
+            final ContentDecoder decoder,
+            final IOControl ioctrl) throws IOException {
+        int lastRead;
+        do {
+            buffer.clear();
+            lastRead = decoder.read(buffer);
+        } while (lastRead > 0);
+    }
+
+    public void finished() {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
index 7dc0923..fb8eb63 100644
--- a/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
+++ b/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java
@@ -52,10 +52,8 @@ public abstract class AbstractContentEncoder implements ContentEncoder {
     protected final HttpTransportMetricsImpl metrics;
 
     /**
-     * @deprecated since 4.3-beta3 - use {@link #isCompleted()} or {@link #complete()} instead
-     * Will probably be made private at some point.
+     * TODO: make private
      */
-    @Deprecated
     protected boolean completed;
 
     /**

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java/org/apache/http/nio/entity/BufferingNHttpEntity.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/BufferingNHttpEntity.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/BufferingNHttpEntity.java
deleted file mode 100644
index f23a614..0000000
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/BufferingNHttpEntity.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * ====================================================================
- * 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.entity;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.entity.HttpEntityWrapper;
-import org.apache.http.nio.ContentDecoder;
-import org.apache.http.nio.IOControl;
-import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.nio.util.SimpleInputBuffer;
-import org.apache.http.util.Args;
-import org.apache.http.util.Asserts;
-
-/**
- * A {@link ConsumingNHttpEntity} that consumes content into a buffer. The
- * content can be retrieved as an InputStream via
- * {@link HttpEntity#getContent()}, or written to an output stream via
- * {@link HttpEntity#writeTo(OutputStream)}.
- *
- * @since 4.0
- *
- * @deprecated use (4.2)
- *  {@link org.apache.http.nio.protocol.BasicAsyncRequestProducer}
- *  or {@link org.apache.http.nio.protocol.BasicAsyncResponseProducer}
- */
-@NotThreadSafe
-@Deprecated
-public class BufferingNHttpEntity extends HttpEntityWrapper implements
-        ConsumingNHttpEntity {
-
-    private final static int BUFFER_SIZE = 2048;
-
-    private final SimpleInputBuffer buffer;
-    private boolean finished;
-    private boolean consumed;
-
-    public BufferingNHttpEntity(
-            final HttpEntity httpEntity,
-            final ByteBufferAllocator allocator) {
-        super(httpEntity);
-        this.buffer = new SimpleInputBuffer(BUFFER_SIZE, allocator);
-    }
-
-    public void consumeContent(
-            final ContentDecoder decoder,
-            final IOControl ioctrl) throws IOException {
-        this.buffer.consumeContent(decoder);
-        if (decoder.isCompleted()) {
-            this.finished = true;
-        }
-    }
-
-    public void finish() {
-        this.finished = true;
-    }
-
-    /**
-     * Obtains entity's content as {@link InputStream}.
-     *
-     *  @throws IllegalStateException if content of the entity has not been
-     *    fully received or has already been consumed.
-     */
-    @Override
-    public InputStream getContent() throws IOException {
-        Asserts.check(this.finished, "Entity content has not been fully received");
-        Asserts.check(!this.consumed, "Entity content has been consumed");
-        this.consumed = true;
-        return new ContentInputStream(this.buffer);
-    }
-
-    @Override
-    public boolean isRepeatable() {
-        return false;
-    }
-
-    @Override
-    public boolean isStreaming() {
-        return true;
-    }
-
-    @Override
-    public void writeTo(final OutputStream outstream) throws IOException {
-        Args.notNull(outstream, "Output stream");
-        final InputStream instream = getContent();
-        final byte[] buff = new byte[BUFFER_SIZE];
-        int l;
-        // consume until EOF
-        while ((l = instream.read(buff)) != -1) {
-            outstream.write(buff, 0, l);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
deleted file mode 100644
index 6695319..0000000
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ConsumingNHttpEntityTemplate.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * ====================================================================
- * 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.entity;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.entity.HttpEntityWrapper;
-import org.apache.http.nio.ContentDecoder;
-import org.apache.http.nio.IOControl;
-
-/**
- * A {@link ConsumingNHttpEntity} that forwards available content to a
- * {@link ContentListener}.
- *
- * @since 4.0
- *
- * @deprecated use (4.2)
- *  {@link org.apache.http.nio.protocol.BasicAsyncRequestProducer}
- *  or {@link org.apache.http.nio.protocol.BasicAsyncResponseProducer}
- */
-@Deprecated
-public class ConsumingNHttpEntityTemplate
-    extends HttpEntityWrapper implements ConsumingNHttpEntity {
-
-    private final ContentListener contentListener;
-
-    public ConsumingNHttpEntityTemplate(
-            final HttpEntity httpEntity,
-            final ContentListener contentListener) {
-        super(httpEntity);
-        this.contentListener = contentListener;
-    }
-
-    public ContentListener getContentListener() {
-        return contentListener;
-    }
-
-    @Override
-    public InputStream getContent() throws IOException, UnsupportedOperationException {
-        throw new UnsupportedOperationException("Does not support blocking methods");
-    }
-
-    @Override
-    public boolean isStreaming() {
-        return true;
-    }
-
-    @Override
-    public void writeTo(final OutputStream out) throws IOException, UnsupportedOperationException {
-        throw new UnsupportedOperationException("Does not support blocking methods");
-    }
-
-    public void consumeContent(
-            final ContentDecoder decoder,
-            final IOControl ioctrl) throws IOException {
-        this.contentListener.contentAvailable(decoder, ioctrl);
-    }
-
-    public void finish() {
-        this.contentListener.finished();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentListener.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentListener.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentListener.java
deleted file mode 100644
index 8063bee..0000000
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/ContentListener.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * ====================================================================
- * 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.entity;
-
-import java.io.IOException;
-
-import org.apache.http.nio.ContentDecoder;
-import org.apache.http.nio.IOControl;
-
-/**
- * A listener for available data on a non-blocking {@link ConsumingNHttpEntity}.
- *
- * @since 4.0
- *
- * @deprecated (4.2)
- */
-@Deprecated
-public interface ContentListener {
-
-    /**
-     * Notification that content is available to be read from the decoder.
-     *
-     * @param decoder content decoder.
-     * @param ioctrl I/O control of the underlying connection.
-     */
-    void contentAvailable(ContentDecoder decoder, IOControl ioctrl)
-        throws IOException;
-
-    /**
-     * Notification that any resources allocated for reading can be released.
-     */
-    void finished();
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NHttpEntityWrapper.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NHttpEntityWrapper.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/NHttpEntityWrapper.java
deleted file mode 100644
index 44bc1be..0000000
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/NHttpEntityWrapper.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * ====================================================================
- * 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.entity;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.Channels;
-import java.nio.channels.ReadableByteChannel;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.entity.HttpEntityWrapper;
-import org.apache.http.nio.ContentEncoder;
-import org.apache.http.nio.IOControl;
-
-/**
- * {@link ProducingNHttpEntity} compatibility adaptor for blocking HTTP
- * entities.
- *
- * @since 4.0
- *
- * @deprecated (4.2) use {@link EntityAsyncContentProducer}
- */
-@NotThreadSafe
-@Deprecated
-public class NHttpEntityWrapper
-    extends HttpEntityWrapper implements ProducingNHttpEntity {
-
-    private final ReadableByteChannel channel;
-    private final ByteBuffer buffer;
-
-    public NHttpEntityWrapper(final HttpEntity httpEntity) throws IOException {
-        super(httpEntity);
-        this.channel = Channels.newChannel(httpEntity.getContent());
-        this.buffer = ByteBuffer.allocate(4096);
-    }
-
-    /**
-     * This method throws {@link UnsupportedOperationException}.
-     */
-    @Override
-    public InputStream getContent() throws IOException, UnsupportedOperationException {
-        throw new UnsupportedOperationException("Does not support blocking methods");
-    }
-
-    @Override
-    public boolean isStreaming() {
-        return true;
-    }
-
-    /**
-     * This method throws {@link UnsupportedOperationException}.
-     */
-    @Override
-    public void writeTo(final OutputStream out) throws IOException, UnsupportedOperationException {
-        throw new UnsupportedOperationException("Does not support blocking methods");
-    }
-
-    public void produceContent(
-            final ContentEncoder encoder,
-            final IOControl ioctrl) throws IOException {
-        final int i = this.channel.read(this.buffer);
-        this.buffer.flip();
-        encoder.write(this.buffer);
-        final boolean buffering = this.buffer.hasRemaining();
-        this.buffer.compact();
-        if (i == -1 && !buffering) {
-            encoder.complete();
-            this.channel.close();
-        }
-    }
-
-    public void finish() {
-        try {
-            this.channel.close();
-        } catch (final IOException ignore) {
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore-nio/src/main/java/org/apache/http/nio/entity/SkipContentListener.java
----------------------------------------------------------------------
diff --git a/httpcore-nio/src/main/java/org/apache/http/nio/entity/SkipContentListener.java b/httpcore-nio/src/main/java/org/apache/http/nio/entity/SkipContentListener.java
deleted file mode 100644
index ca6e93d..0000000
--- a/httpcore-nio/src/main/java/org/apache/http/nio/entity/SkipContentListener.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * ====================================================================
- * 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.entity;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.apache.http.nio.ContentDecoder;
-import org.apache.http.nio.IOControl;
-import org.apache.http.nio.util.ByteBufferAllocator;
-import org.apache.http.util.Args;
-
-/**
- * A simple {@link ContentListener} that reads and ignores all content.
- *
- * @since 4.0
- *
- * @deprecated (4.2)
- */
-@Deprecated
-public class SkipContentListener implements ContentListener {
-
-    private final ByteBuffer buffer;
-
-    public SkipContentListener(final ByteBufferAllocator allocator) {
-        super();
-        Args.notNull(allocator, "ByteBuffer allocator");
-        this.buffer = allocator.allocate(2048);
-    }
-
-    public void contentAvailable(
-            final ContentDecoder decoder,
-            final IOControl ioctrl) throws IOException {
-        int lastRead;
-        do {
-            buffer.clear();
-            lastRead = decoder.read(buffer);
-        } while (lastRead > 0);
-    }
-
-    public void finished() {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/6289707a/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java b/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
index 5c21365..28c5cbc 100644
--- a/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
+++ b/httpcore/src/main/java/org/apache/http/entity/ByteArrayEntity.java
@@ -54,6 +54,7 @@ public class ByteArrayEntity extends AbstractHttpEntity implements Cloneable {
     /**
      * @since 4.2
      */
+    @SuppressWarnings("deprecation")
     public ByteArrayEntity(final byte[] b, final ContentType contentType) {
         super();
         Args.notNull(b, "Source byte array");
@@ -69,6 +70,7 @@ public class ByteArrayEntity extends AbstractHttpEntity implements Cloneable {
     /**
      * @since 4.2
      */
+    @SuppressWarnings("deprecation")
     public ByteArrayEntity(final byte[] b, final int off, final int len, final ContentType contentType) {
         super();
         Args.notNull(b, "Source byte array");