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 StringdefaultCharsetName -
Method Summary
Modifier and Type Method Description static StringasciiOnly(String s)static StringbyteBufferToString(byte[] bytes, int offset, int length)static StringbyteBufferToString(byte[] bytes, int offset, int length, String charsetName)static StringbyteBufferToStringIgnoringEncodingIssues(byte[] bytes, int offset, int length)static booleancheckBit(byte b, int bitPosition)static byte[]copyBuffer(byte[] bytes, int offset, int length)static voidcopyIntoByteBuffer(byte[] bytes, int offset, int length, byte[] destBuffer, int destOffset)static intindexOfTerminator(byte[] bytes)static intindexOfTerminator(byte[] bytes, int fromIndex)static intindexOfTerminator(byte[] bytes, int fromIndex, int terminatorLength)static intindexOfTerminatorForEncoding(byte[] bytes, int fromIndex, int encoding)static byte[]packInteger(int i)static byte[]packSynchsafeInteger(int i)static voidpackSynchsafeInteger(int i, byte[] bytes, int offset)static StringpadStringRight(String s, int length, char padWith)static bytesetBit(byte b, int bitPosition, boolean value)static intshiftByte(byte c, int places)static intsizeSynchronisationWouldSubtract(byte[] bytes)static intsizeUnsynchronisationWouldAdd(byte[] bytes)static voidstringIntoByteBuffer(String s, int offset, int length, byte[] bytes, int destOffset)static voidstringIntoByteBuffer(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 Stringsubstitute(String s, String replaceThis, String withThis)static byte[]synchroniseBuffer(byte[] bytes)static StringtrimStringRight(String s)static intunpackInteger(byte b1, byte b2, byte b3, byte b4)static intunpackSynchsafeInteger(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)
-