Assert.notNull(predicate,"'predicate' must not be null");
Assert.notNull(predicate,"IntPredicate must not be null");
inti=Math.min(fromIndex,this.writePosition-1);
for(;i>=0;i--){
byteb=this.byteBuffer.get(i);
@ -149,7 +149,6 @@ public class DefaultDataBuffer implements DataBuffer {
@@ -149,7 +149,6 @@ public class DefaultDataBuffer implements DataBuffer {
assertIndex(readPosition>=0,"'readPosition' %d must be >= 0",readPosition);
assertIndex(readPosition<=this.writePosition,"'readPosition' %d must be <= %d",
readPosition,this.writePosition);
this.readPosition=readPosition;
returnthis;
}
@ -165,7 +164,6 @@ public class DefaultDataBuffer implements DataBuffer {
@@ -165,7 +164,6 @@ public class DefaultDataBuffer implements DataBuffer {
writePosition,this.readPosition);
assertIndex(writePosition<=this.capacity,"'writePosition' %d must be <= %d",
writePosition,this.capacity);
this.writePosition=writePosition;
returnthis;
}
@ -177,9 +175,9 @@ public class DefaultDataBuffer implements DataBuffer {
@@ -177,9 +175,9 @@ public class DefaultDataBuffer implements DataBuffer {
@Override
publicDefaultDataBuffercapacity(intnewCapacity){
Assert.isTrue(newCapacity>0,
String.format("'newCapacity' %d must be higher than 0",newCapacity));
if(newCapacity<=0){
thrownewIllegalArgumentException(String.format("'newCapacity' %d must be higher than 0",newCapacity));
}
intreadPosition=readPosition();
intwritePosition=writePosition();
intoldCapacity=capacity();
@ -225,15 +223,13 @@ public class DefaultDataBuffer implements DataBuffer {
@@ -225,15 +223,13 @@ public class DefaultDataBuffer implements DataBuffer {
assertIndex(index>=0,"index %d must be >= 0",index);
assertIndex(index<=this.writePosition-1,"index %d must be <= %d",
index,this.writePosition-1);
assertIndex(index<=this.writePosition-1,"index %d must be <= %d",index,this.writePosition-1);
returnthis.byteBuffer.get(index);
}
@ -249,14 +245,14 @@ public class DefaultDataBuffer implements DataBuffer {
@@ -249,14 +245,14 @@ public class DefaultDataBuffer implements DataBuffer {
@Override
publicDefaultDataBufferread(byte[]destination){
Assert.notNull(destination,"'destination' must not be null");
Assert.notNull(destination,"Byte array must not be null");
"readPosition %d and length %d should be smaller than writePosition %d",
this.readPosition,length,this.writePosition);
@ -281,14 +277,14 @@ public class DefaultDataBuffer implements DataBuffer {
@@ -281,14 +277,14 @@ public class DefaultDataBuffer implements DataBuffer {
@Override
publicDefaultDataBufferwrite(byte[]source){
Assert.notNull(source,"'source' must not be null");
Assert.notNull(source,"Byte array must not be null");
Assert.notNull(source,"'source' must not be null");
Assert.notNull(source,"Byte array must not be null");
ensureCapacity(length);
ByteBuffertmp=this.byteBuffer.duplicate();
@ -309,11 +305,12 @@ public class DefaultDataBuffer implements DataBuffer {
@@ -309,11 +305,12 @@ public class DefaultDataBuffer implements DataBuffer {
@ -240,8 +241,8 @@ public class NettyDataBuffer implements PooledDataBuffer {
@@ -240,8 +241,8 @@ public class NettyDataBuffer implements PooledDataBuffer {