public class BufferTools extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
defaultCharsetName |
| Constructor and Description |
|---|
BufferTools() |
| Modifier and Type | Method and Description |
|---|---|
static String |
asciiOnly(String s) |
static String |
byteBufferToString(byte[] bytes,
int offset,
int length) |
static String |
byteBufferToString(byte[] bytes,
int offset,
int length,
String charsetName) |
static String |
byteBufferToStringIgnoringEncodingIssues(byte[] bytes,
int offset,
int length) |
static boolean |
checkBit(byte b,
int bitPosition) |
static byte[] |
copyBuffer(byte[] bytes,
int offset,
int length) |
static void |
copyIntoByteBuffer(byte[] bytes,
int offset,
int length,
byte[] destBuffer,
int destOffset) |
static int |
indexOfTerminator(byte[] bytes) |
static int |
indexOfTerminator(byte[] bytes,
int fromIndex) |
static int |
indexOfTerminator(byte[] bytes,
int fromIndex,
int terminatorLength) |
static int |
indexOfTerminatorForEncoding(byte[] bytes,
int fromIndex,
int encoding) |
static byte[] |
packInteger(int i) |
static byte[] |
packSynchsafeInteger(int i) |
static void |
packSynchsafeInteger(int i,
byte[] bytes,
int offset) |
static String |
padStringRight(String s,
int length,
char padWith) |
static byte |
setBit(byte b,
int bitPosition,
boolean value) |
static int |
shiftByte(byte c,
int places) |
static int |
sizeSynchronisationWouldSubtract(byte[] bytes) |
static int |
sizeUnsynchronisationWouldAdd(byte[] bytes) |
static void |
stringIntoByteBuffer(String s,
int offset,
int length,
byte[] bytes,
int destOffset) |
static void |
stringIntoByteBuffer(String s,
int offset,
int length,
byte[] bytes,
int destOffset,
String charsetName) |
static byte[] |
stringToByteBuffer(String s,
int offset,
int length) |
static byte[] |
stringToByteBuffer(String s,
int offset,
int length,
String charsetName) |
static byte[] |
stringToByteBufferIgnoringEncodingIssues(String s,
int offset,
int length) |
static String |
substitute(String s,
String replaceThis,
String withThis) |
static byte[] |
synchroniseBuffer(byte[] bytes) |
static String |
trimStringRight(String s) |
static int |
unpackInteger(byte b1,
byte b2,
byte b3,
byte b4) |
static int |
unpackSynchsafeInteger(byte b1,
byte b2,
byte b3,
byte b4) |
static byte[] |
unsynchroniseBuffer(byte[] bytes) |
protected static final String defaultCharsetName
public static String byteBufferToStringIgnoringEncodingIssues(byte[] bytes, int offset, int length)
public static String byteBufferToString(byte[] bytes, int offset, int length) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static String byteBufferToString(byte[] bytes, int offset, int length, String charsetName) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static byte[] stringToByteBufferIgnoringEncodingIssues(String s, int offset, int length)
public static byte[] stringToByteBuffer(String s, int offset, int length) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static byte[] stringToByteBuffer(String s, int offset, int length, String charsetName) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static void stringIntoByteBuffer(String s, int offset, int length, byte[] bytes, int destOffset) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static void stringIntoByteBuffer(String s, int offset, int length, byte[] bytes, int destOffset, String charsetName) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic static boolean checkBit(byte b,
int bitPosition)
public static byte setBit(byte b,
int bitPosition,
boolean value)
public static int shiftByte(byte c,
int places)
public static int unpackInteger(byte b1,
byte b2,
byte b3,
byte b4)
public static byte[] packInteger(int i)
public static int unpackSynchsafeInteger(byte b1,
byte b2,
byte b3,
byte b4)
public static byte[] packSynchsafeInteger(int i)
public static void packSynchsafeInteger(int i,
byte[] bytes,
int offset)
public static byte[] copyBuffer(byte[] bytes,
int offset,
int length)
public static void copyIntoByteBuffer(byte[] bytes,
int offset,
int length,
byte[] destBuffer,
int destOffset)
public static int sizeUnsynchronisationWouldAdd(byte[] bytes)
public static byte[] unsynchroniseBuffer(byte[] bytes)
public static int sizeSynchronisationWouldSubtract(byte[] bytes)
public static byte[] synchroniseBuffer(byte[] bytes)
public static int indexOfTerminator(byte[] bytes)
public static int indexOfTerminator(byte[] bytes,
int fromIndex)
public static int indexOfTerminator(byte[] bytes,
int fromIndex,
int terminatorLength)
public static int indexOfTerminatorForEncoding(byte[] bytes,
int fromIndex,
int encoding)