NETTY-335 Remove deprecated elements
This commit is contained in:
parent
f4e83e0421
commit
5518344bc3
@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.channels.GatheringByteChannel;
|
||||
import java.nio.channels.ScatteringByteChannel;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
|
||||
/**
|
||||
@ -309,30 +308,12 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
|
||||
return buf;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ChannelBuffer readBytes(ChannelBufferIndexFinder endIndexFinder) {
|
||||
int endIndex = indexOf(readerIndex, writerIndex, endIndexFinder);
|
||||
if (endIndex < 0) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
return readBytes(endIndex - readerIndex);
|
||||
}
|
||||
|
||||
public ChannelBuffer readSlice(int length) {
|
||||
ChannelBuffer slice = slice(readerIndex, length);
|
||||
readerIndex += length;
|
||||
return slice;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ChannelBuffer readSlice(ChannelBufferIndexFinder endIndexFinder) {
|
||||
int endIndex = indexOf(readerIndex, writerIndex, endIndexFinder);
|
||||
if (endIndex < 0) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
return readSlice(endIndex - readerIndex);
|
||||
}
|
||||
|
||||
public void readBytes(byte[] dst, int dstIndex, int length) {
|
||||
checkReadableBytes(length);
|
||||
getBytes(readerIndex, dst, dstIndex, length);
|
||||
@ -390,17 +371,6 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
|
||||
readerIndex = newReaderIndex;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int skipBytes(ChannelBufferIndexFinder firstIndexFinder) {
|
||||
int oldReaderIndex = readerIndex;
|
||||
int newReaderIndex = indexOf(oldReaderIndex, writerIndex, firstIndexFinder);
|
||||
if (newReaderIndex < 0) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
readerIndex(newReaderIndex);
|
||||
return newReaderIndex - oldReaderIndex;
|
||||
}
|
||||
|
||||
public void writeByte(int value) {
|
||||
setByte(writerIndex ++, value);
|
||||
}
|
||||
@ -547,37 +517,6 @@ public abstract class AbstractChannelBuffer implements ChannelBuffer {
|
||||
toByteBuffer(index, length), charset);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(int index, int length, String charsetName,
|
||||
ChannelBufferIndexFinder terminatorFinder) {
|
||||
if (terminatorFinder == null) {
|
||||
return toString(index, length, charsetName);
|
||||
}
|
||||
|
||||
int terminatorIndex = indexOf(index, index + length, terminatorFinder);
|
||||
if (terminatorIndex < 0) {
|
||||
return toString(index, length, charsetName);
|
||||
}
|
||||
|
||||
return toString(index, terminatorIndex - index, charsetName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(int index, int length, String charsetName) {
|
||||
return toString(index, length, Charset.forName(charsetName));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(String charsetName,
|
||||
ChannelBufferIndexFinder terminatorFinder) {
|
||||
return toString(readerIndex, readableBytes(), charsetName, terminatorFinder);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(String charsetName) {
|
||||
return toString(Charset.forName(charsetName));
|
||||
}
|
||||
|
||||
public int indexOf(int fromIndex, int toIndex, byte value) {
|
||||
return ChannelBuffers.indexOf(this, fromIndex, toIndex, value);
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ import java.nio.charset.UnsupportedCharsetException;
|
||||
*
|
||||
* <h4>Strings</h4>
|
||||
*
|
||||
* Various {@link #toString(String)} methods convert a {@link ChannelBuffer}
|
||||
* Various {@link #toString(Charset)} methods convert a {@link ChannelBuffer}
|
||||
* into a {@link String}. Please note that {@link #toString()} is not a
|
||||
* conversion method.
|
||||
*
|
||||
@ -1094,12 +1094,6 @@ public interface ChannelBuffer extends Comparable<ChannelBuffer> {
|
||||
*/
|
||||
ChannelBuffer readBytes(int length);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #bytesBefore(ChannelBufferIndexFinder)} and {@link #readBytes(int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ChannelBuffer readBytes(ChannelBufferIndexFinder indexFinder);
|
||||
|
||||
/**
|
||||
* Returns a new slice of this buffer's sub-region starting at the current
|
||||
* {@code readerIndex} and increases the {@code readerIndex} by the size
|
||||
@ -1114,12 +1108,6 @@ public interface ChannelBuffer extends Comparable<ChannelBuffer> {
|
||||
*/
|
||||
ChannelBuffer readSlice(int length);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #bytesBefore(ChannelBufferIndexFinder)} and {@link #readSlice(int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ChannelBuffer readSlice(ChannelBufferIndexFinder indexFinder);
|
||||
|
||||
/**
|
||||
* Transfers this buffer's data to the specified destination starting at
|
||||
* the current {@code readerIndex} until the destination becomes
|
||||
@ -1241,12 +1229,6 @@ public interface ChannelBuffer extends Comparable<ChannelBuffer> {
|
||||
*/
|
||||
void skipBytes(int length);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #bytesBefore(ChannelBufferIndexFinder)} and {@link #skipBytes(int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
int skipBytes(ChannelBufferIndexFinder indexFinder);
|
||||
|
||||
/**
|
||||
* Sets the specified byte at the current {@code writerIndex}
|
||||
* and increases the {@code writerIndex} by {@code 1} in this buffer.
|
||||
@ -1717,33 +1699,6 @@ public interface ChannelBuffer extends Comparable<ChannelBuffer> {
|
||||
*/
|
||||
String toString(int index, int length, Charset charset);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #toString(Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
String toString(String charsetName);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #bytesBefore(ChannelBufferIndexFinder)} and {@link #toString(int, int, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
String toString(
|
||||
String charsetName, ChannelBufferIndexFinder terminatorFinder);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #bytesBefore(int, int, ChannelBufferIndexFinder)} and {@link #toString(int, int, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
String toString(int index, int length, String charsetName);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #bytesBefore(int, int, ChannelBufferIndexFinder)} and {@link #toString(int, int, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
String toString(
|
||||
int index, int length, String charsetName,
|
||||
ChannelBufferIndexFinder terminatorFinder);
|
||||
|
||||
/**
|
||||
* Returns a hash code which was calculated from the content of this
|
||||
* buffer. If there's a byte array which is
|
||||
|
@ -811,22 +811,6 @@ public class ChannelBuffers {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #copiedBuffer(CharSequence, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ChannelBuffer copiedBuffer(String string, String charsetName) {
|
||||
return copiedBuffer(string, Charset.forName(charsetName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #copiedBuffer(ByteOrder, CharSequence, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ChannelBuffer copiedBuffer(ByteOrder endianness, String string, String charsetName) {
|
||||
return copiedBuffer(endianness, string, Charset.forName(charsetName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a read-only buffer which disallows any modification operations
|
||||
* on the specified {@code buffer}. The new buffer has the same
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 Red Hat, Inc.
|
||||
*
|
||||
* Red Hat 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.
|
||||
*/
|
||||
package org.jboss.netty.channel;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.jboss.netty.channel.ChannelHandler.Sharable;
|
||||
|
||||
/**
|
||||
* @deprecated Use the {@link Sharable} annotation instead.
|
||||
|
||||
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
|
||||
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
|
||||
*
|
||||
* @version $Rev$, $Date$
|
||||
*
|
||||
* @apiviz.exclude
|
||||
*/
|
||||
@Inherited
|
||||
@Documented
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Deprecated
|
||||
public @interface ChannelPipelineCoverage {
|
||||
|
||||
/**
|
||||
* {@code "all"}
|
||||
*/
|
||||
public static final String ALL = "all";
|
||||
|
||||
/**
|
||||
* {@code "one"}
|
||||
*/
|
||||
public static final String ONE = "one";
|
||||
|
||||
/**
|
||||
* The value of this annotation
|
||||
*/
|
||||
String value();
|
||||
}
|
@ -50,9 +50,6 @@ class NioProviderMetadata {
|
||||
private static final String CONSTRAINT_LEVEL_PROPERTY =
|
||||
"org.jboss.netty.channel.socket.nio.constraintLevel";
|
||||
|
||||
private static final String OLD_CONSTRAINT_LEVEL_PROPERTY =
|
||||
"java.nio.channels.spi.constraintLevel";
|
||||
|
||||
/**
|
||||
* 0 - no need to wake up to get / set interestOps (most cases)
|
||||
* 1 - no need to wake up to get interestOps, but need to wake up to set.
|
||||
@ -66,17 +63,7 @@ class NioProviderMetadata {
|
||||
// Use the system property if possible.
|
||||
constraintLevel = SystemPropertyUtil.get(CONSTRAINT_LEVEL_PROPERTY, -1);
|
||||
if (constraintLevel < 0 || constraintLevel > 2) {
|
||||
// Try the old property.
|
||||
constraintLevel = SystemPropertyUtil.get(OLD_CONSTRAINT_LEVEL_PROPERTY, -1);
|
||||
if (constraintLevel < 0 || constraintLevel > 2) {
|
||||
constraintLevel = -1;
|
||||
} else {
|
||||
logger.warn(
|
||||
"System property '" +
|
||||
OLD_CONSTRAINT_LEVEL_PROPERTY +
|
||||
"' has been deprecated. Use '" +
|
||||
CONSTRAINT_LEVEL_PROPERTY + "' instead.");
|
||||
}
|
||||
constraintLevel = -1;
|
||||
}
|
||||
|
||||
if (constraintLevel >= 0) {
|
||||
|
@ -61,16 +61,6 @@ public class DefaultHttpMessage implements HttpMessage {
|
||||
headers.removeHeader(name);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public long getContentLength() {
|
||||
return HttpHeaders.getContentLength(this);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public long getContentLength(long defaultValue) {
|
||||
return HttpHeaders.getContentLength(this, defaultValue);
|
||||
}
|
||||
|
||||
public boolean isChunked() {
|
||||
if (chunked) {
|
||||
return true;
|
||||
@ -86,11 +76,6 @@ public class DefaultHttpMessage implements HttpMessage {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isKeepAlive() {
|
||||
return HttpHeaders.isKeepAlive(this);
|
||||
}
|
||||
|
||||
public void clearHeaders() {
|
||||
headers.clearHeaders();
|
||||
}
|
||||
@ -149,7 +134,7 @@ public class DefaultHttpMessage implements HttpMessage {
|
||||
buf.append("(version: ");
|
||||
buf.append(getProtocolVersion().getText());
|
||||
buf.append(", keepAlive: ");
|
||||
buf.append(isKeepAlive());
|
||||
buf.append(HttpHeaders.isKeepAlive(this));
|
||||
buf.append(", chunked: ");
|
||||
buf.append(isChunked());
|
||||
buf.append(')');
|
||||
|
@ -125,18 +125,6 @@ public interface HttpMessage {
|
||||
*/
|
||||
void clearHeaders();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link HttpHeaders#getContentLength(HttpMessage)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
long getContentLength();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link HttpHeaders#getContentLength(HttpMessage, long)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
long getContentLength(long defaultValue);
|
||||
|
||||
/**
|
||||
* Returns {@code true} if and only if this message does not have any
|
||||
* content but the {@link HttpChunk}s, which is generated by
|
||||
@ -162,10 +150,4 @@ public interface HttpMessage {
|
||||
* this message is {@code "chunked"}.
|
||||
*/
|
||||
void setChunked(boolean chunked);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link HttpHeaders#isKeepAlive(HttpMessage)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isKeepAlive();
|
||||
}
|
||||
|
@ -74,14 +74,6 @@ public class HttpVersion implements Comparable<HttpVersion> {
|
||||
private final String text;
|
||||
private final boolean keepAliveDefault;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #HttpVersion(String, boolean)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpVersion(String text) {
|
||||
this(text, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new HTTP version with the specified version string. You will
|
||||
* not need to create a new instance unless you are implementing a protocol
|
||||
@ -115,15 +107,6 @@ public class HttpVersion implements Comparable<HttpVersion> {
|
||||
this.keepAliveDefault = keepAliveDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #HttpVersion(String, int, int, boolean)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public HttpVersion(
|
||||
String protocolName, int majorVersion, int minorVersion) {
|
||||
this(protocolName, majorVersion, minorVersion, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new HTTP version with the specified protocol name and version
|
||||
* numbers. You will not need to create a new instance unless you are
|
||||
|
@ -77,14 +77,6 @@ public class QueryStringDecoder {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #QueryStringDecoder(String, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public QueryStringDecoder(String uri, String charset) {
|
||||
this(uri, Charset.forName(charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new decoder that decodes the specified URI. The decoder will
|
||||
* assume that the query string is encoded in UTF-8.
|
||||
@ -109,14 +101,6 @@ public class QueryStringDecoder {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #QueryStringDecoder(URI, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public QueryStringDecoder(URI uri, String charset){
|
||||
this(uri, Charset.forName(charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the decoded path string of the URI.
|
||||
*/
|
||||
|
@ -74,14 +74,6 @@ public class QueryStringEncoder {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #QueryStringEncoder(String, Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public QueryStringEncoder(String uri, String charset) {
|
||||
this(uri, Charset.forName(charset));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a parameter with the specified name and value to this encoder.
|
||||
*/
|
||||
|
@ -343,15 +343,6 @@ class ReplayingDecoderBuffer implements ChannelBuffer {
|
||||
throw new UnreplayableOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ChannelBuffer readBytes(ChannelBufferIndexFinder endIndexFinder) {
|
||||
int endIndex = buffer.indexOf(buffer.readerIndex(), buffer.writerIndex(), endIndexFinder);
|
||||
if (endIndex < 0) {
|
||||
throw REPLAY;
|
||||
}
|
||||
return buffer.readBytes(endIndex - buffer.readerIndex());
|
||||
}
|
||||
|
||||
public int readBytes(GatheringByteChannel out, int length)
|
||||
throws IOException {
|
||||
throw new UnreplayableOperationException();
|
||||
@ -362,16 +353,6 @@ class ReplayingDecoderBuffer implements ChannelBuffer {
|
||||
return buffer.readBytes(length);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public ChannelBuffer readSlice(
|
||||
ChannelBufferIndexFinder endIndexFinder) {
|
||||
int endIndex = buffer.indexOf(buffer.readerIndex(), buffer.writerIndex(), endIndexFinder);
|
||||
if (endIndex < 0) {
|
||||
throw REPLAY;
|
||||
}
|
||||
return buffer.readSlice(endIndex - buffer.readerIndex());
|
||||
}
|
||||
|
||||
public ChannelBuffer readSlice(int length) {
|
||||
checkReadableBytes(length);
|
||||
return buffer.readSlice(length);
|
||||
@ -521,17 +502,6 @@ class ReplayingDecoderBuffer implements ChannelBuffer {
|
||||
throw new UnreplayableOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int skipBytes(ChannelBufferIndexFinder firstIndexFinder) {
|
||||
int oldReaderIndex = buffer.readerIndex();
|
||||
int newReaderIndex = buffer.indexOf(oldReaderIndex, buffer.writerIndex(), firstIndexFinder);
|
||||
if (newReaderIndex < 0) {
|
||||
throw REPLAY;
|
||||
}
|
||||
buffer.readerIndex(newReaderIndex);
|
||||
return newReaderIndex - oldReaderIndex;
|
||||
}
|
||||
|
||||
public void skipBytes(int length) {
|
||||
checkReadableBytes(length);
|
||||
buffer.skipBytes(length);
|
||||
@ -573,31 +543,6 @@ class ReplayingDecoderBuffer implements ChannelBuffer {
|
||||
throw new UnreplayableOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(int index, int length, String charsetName) {
|
||||
checkIndex(index, length);
|
||||
return buffer.toString(index, length, charsetName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(
|
||||
int index, int length, String charsetName,
|
||||
ChannelBufferIndexFinder terminatorFinder) {
|
||||
checkIndex(index, length);
|
||||
return buffer.toString(index, length, charsetName, terminatorFinder);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(String charsetName) {
|
||||
throw new UnreplayableOperationException();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String toString(
|
||||
String charsetName, ChannelBufferIndexFinder terminatorFinder) {
|
||||
throw new UnreplayableOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + '(' +
|
||||
|
@ -83,14 +83,6 @@ public class StringDecoder extends OneToOneDecoder {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #StringDecoder(Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public StringDecoder(String charsetName) {
|
||||
this(Charset.forName(charsetName));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object decode(
|
||||
ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
|
||||
|
@ -81,14 +81,6 @@ public class StringEncoder extends OneToOneEncoder {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #StringEncoder(Charset)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public StringEncoder(String charsetName) {
|
||||
this(Charset.forName(charsetName));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object encode(
|
||||
ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception {
|
||||
|
@ -352,14 +352,6 @@ public class SslHandler extends FrameDecoder
|
||||
return handshakeFuture;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #handshake()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ChannelFuture handshake(@SuppressWarnings("unused") Channel channel) {
|
||||
return handshake();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an SSL {@code close_notify} message to the specified channel and
|
||||
* destroys the underlying {@link SSLEngine}.
|
||||
@ -375,14 +367,6 @@ public class SslHandler extends FrameDecoder
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #close()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ChannelFuture close(@SuppressWarnings("unused") Channel channel) {
|
||||
return close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if and only if TLS renegotiation is enabled.
|
||||
*/
|
||||
|
@ -23,7 +23,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
@ -1198,31 +1197,6 @@ public abstract class AbstractChannelBufferTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSequentialCopiedBufferTransfer2() {
|
||||
buffer.clear();
|
||||
buffer.writeZero(buffer.capacity());
|
||||
try {
|
||||
buffer.readBytes(ChannelBufferIndexFinder.CR);
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
assertSame(EMPTY_BUFFER, buffer.readBytes(ChannelBufferIndexFinder.NUL));
|
||||
|
||||
buffer.clear();
|
||||
buffer.writeBytes(new byte[] { 1, 2, 3, 4, 0 });
|
||||
|
||||
ChannelBuffer copy = buffer.readBytes(ChannelBufferIndexFinder.NUL);
|
||||
assertEquals(wrappedBuffer(new byte[] { 1, 2, 3, 4 }), copy);
|
||||
|
||||
// Make sure if it is a copied buffer.
|
||||
copy.setByte(0, (byte) (copy.getByte(0) + 1));
|
||||
assertFalse(buffer.getByte(0) == copy.getByte(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSequentialSlice1() {
|
||||
buffer.writerIndex(0);
|
||||
@ -1249,31 +1223,6 @@ public abstract class AbstractChannelBufferTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSequentialSlice2() {
|
||||
buffer.clear();
|
||||
buffer.writeZero(buffer.capacity());
|
||||
try {
|
||||
buffer.readSlice(ChannelBufferIndexFinder.CR);
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
assertSame(EMPTY_BUFFER, buffer.readSlice(ChannelBufferIndexFinder.NUL));
|
||||
|
||||
buffer.clear();
|
||||
buffer.writeBytes(new byte[] { 1, 2, 3, 4, 0 });
|
||||
|
||||
ChannelBuffer slice = buffer.readSlice(ChannelBufferIndexFinder.NUL);
|
||||
assertEquals(wrappedBuffer(new byte[] { 1, 2, 3, 4 }), slice);
|
||||
|
||||
// Make sure if it is a sliced buffer.
|
||||
slice.setByte(0, (byte) (slice.getByte(0) + 1));
|
||||
assertTrue(buffer.getByte(0) == slice.getByte(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteZero() {
|
||||
try {
|
||||
@ -1658,28 +1607,6 @@ public abstract class AbstractChannelBufferTest {
|
||||
assertEquals(CAPACITY / 4 * 2, buffer.readerIndex());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void testSkipBytes2() {
|
||||
buffer.clear();
|
||||
buffer.writeZero(buffer.capacity());
|
||||
|
||||
try {
|
||||
buffer.skipBytes(ChannelBufferIndexFinder.LF);
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
// Expected
|
||||
}
|
||||
|
||||
buffer.skipBytes(ChannelBufferIndexFinder.NUL);
|
||||
assertEquals(0, buffer.readerIndex());
|
||||
|
||||
buffer.clear();
|
||||
buffer.writeBytes(new byte[] { 1, 2, 3, 4, 0 });
|
||||
buffer.skipBytes(ChannelBufferIndexFinder.NUL);
|
||||
assertEquals(4, buffer.readerIndex());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
ChannelBuffer elemA = buffer(15);
|
||||
|
Loading…
Reference in New Issue
Block a user