Code polish, suppressed unused methods, etc
This commit is contained in:
parent
6270168430
commit
11050a86de
@ -32,6 +32,7 @@ import java.util.Arrays;
|
|||||||
*
|
*
|
||||||
* @author Nathan Sweet <misc@n4te.com>
|
* @author Nathan Sweet <misc@n4te.com>
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unused", "DuplicatedCode", "ForLoopReplaceableByForEach"})
|
||||||
public class ByteBuffer2 {
|
public class ByteBuffer2 {
|
||||||
private int capacity; // exactly how many bytes have been allocated
|
private int capacity; // exactly how many bytes have been allocated
|
||||||
private int maxCapacity; // how large we can grow
|
private int maxCapacity; // how large we can grow
|
||||||
@ -588,10 +589,8 @@ public class ByteBuffer2 {
|
|||||||
if ((buffer[p++] & 0x80) == 0) {
|
if ((buffer[p++] & 0x80) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p == this.capacity) {
|
|
||||||
return false;
|
return p != this.capacity;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -630,10 +629,8 @@ public class ByteBuffer2 {
|
|||||||
if ((buffer[p++] & 0x80) == 0) {
|
if ((buffer[p++] & 0x80) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p == this.capacity) {
|
|
||||||
return false;
|
return p != this.capacity;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// string
|
// string
|
||||||
@ -1081,7 +1078,7 @@ public class ByteBuffer2 {
|
|||||||
case 0 :
|
case 0 :
|
||||||
return null;
|
return null;
|
||||||
case 1 :
|
case 1 :
|
||||||
return new StringBuilder("");
|
return new StringBuilder();
|
||||||
}
|
}
|
||||||
charCount--;
|
charCount--;
|
||||||
if (this.chars.length < charCount) {
|
if (this.chars.length < charCount) {
|
||||||
@ -1380,10 +1377,8 @@ public class ByteBuffer2 {
|
|||||||
if ((buffer[p++] & 0x80) == 0) {
|
if ((buffer[p++] & 0x80) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p == this.capacity) {
|
|
||||||
return false;
|
return p != this.capacity;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1445,10 +1440,8 @@ public class ByteBuffer2 {
|
|||||||
if ((buffer[p++] & 0x80) == 0) {
|
if ((buffer[p++] & 0x80) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (p == this.capacity) {
|
|
||||||
return false;
|
return p != this.capacity;
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1490,7 +1483,7 @@ public class ByteBuffer2 {
|
|||||||
| (long) (buffer[position++] & 0xFF) << 24
|
| (long) (buffer[position++] & 0xFF) << 24
|
||||||
| (buffer[position++] & 0xFF) << 16
|
| (buffer[position++] & 0xFF) << 16
|
||||||
| (buffer[position++] & 0xFF) << 8
|
| (buffer[position++] & 0xFF) << 8
|
||||||
| buffer[position++] & 0xFF;
|
| buffer[position] & 0xFF;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1654,7 +1647,7 @@ public class ByteBuffer2 {
|
|||||||
*/
|
*/
|
||||||
public char readChar(int position) {
|
public char readChar(int position) {
|
||||||
byte[] buffer = this.bytes;
|
byte[] buffer = this.bytes;
|
||||||
return (char) ((buffer[position++] & 0xFF) << 8 | buffer[position++] & 0xFF);
|
return (char) ((buffer[position++] & 0xFF) << 8 | buffer[position] & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
// double
|
// double
|
||||||
|
Loading…
Reference in New Issue
Block a user