Package com.mpatric.mp3agic
Class BufferTools
java.lang.Object
com.mpatric.mp3agic.BufferTools
public final class BufferTools extends Object
-
Field Summary
Fields Modifier and Type Field Description protected static String
defaultCharsetName
-
Method Summary
Modifier and Type Method 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)
-
Field Details
-
defaultCharsetName
- See Also:
- Constant Field Values
-
-
Method Details
-
byteBufferToStringIgnoringEncodingIssues
public static String byteBufferToStringIgnoringEncodingIssues(byte[] bytes, int offset, int length) -
byteBufferToString
public static String byteBufferToString(byte[] bytes, int offset, int length) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
byteBufferToString
public static String byteBufferToString(byte[] bytes, int offset, int length, String charsetName) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
stringToByteBufferIgnoringEncodingIssues
-
stringToByteBuffer
public static byte[] stringToByteBuffer(String s, int offset, int length) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
stringToByteBuffer
public static byte[] stringToByteBuffer(String s, int offset, int length, String charsetName) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
stringIntoByteBuffer
public static void stringIntoByteBuffer(String s, int offset, int length, byte[] bytes, int destOffset) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
stringIntoByteBuffer
public static void stringIntoByteBuffer(String s, int offset, int length, byte[] bytes, int destOffset, String charsetName) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
trimStringRight
-
padStringRight
-
checkBit
public static boolean checkBit(byte b, int bitPosition) -
setBit
public static byte setBit(byte b, int bitPosition, boolean value) -
shiftByte
public static int shiftByte(byte c, int places) -
unpackInteger
public static int unpackInteger(byte b1, byte b2, byte b3, byte b4) -
packInteger
public static byte[] packInteger(int i) -
unpackSynchsafeInteger
public static int unpackSynchsafeInteger(byte b1, byte b2, byte b3, byte b4) -
packSynchsafeInteger
public static byte[] packSynchsafeInteger(int i) -
packSynchsafeInteger
public static void packSynchsafeInteger(int i, byte[] bytes, int offset) -
copyBuffer
public static byte[] copyBuffer(byte[] bytes, int offset, int length) -
copyIntoByteBuffer
public static void copyIntoByteBuffer(byte[] bytes, int offset, int length, byte[] destBuffer, int destOffset) -
sizeUnsynchronisationWouldAdd
public static int sizeUnsynchronisationWouldAdd(byte[] bytes) -
unsynchroniseBuffer
public static byte[] unsynchroniseBuffer(byte[] bytes) -
sizeSynchronisationWouldSubtract
public static int sizeSynchronisationWouldSubtract(byte[] bytes) -
synchroniseBuffer
public static byte[] synchroniseBuffer(byte[] bytes) -
substitute
-
asciiOnly
-
indexOfTerminator
public static int indexOfTerminator(byte[] bytes) -
indexOfTerminator
public static int indexOfTerminator(byte[] bytes, int fromIndex) -
indexOfTerminator
public static int indexOfTerminator(byte[] bytes, int fromIndex, int terminatorLength) -
indexOfTerminatorForEncoding
public static int indexOfTerminatorForEncoding(byte[] bytes, int fromIndex, int encoding)
-