public class TuneUtils extends Object
Constructor and Description |
---|
TuneUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
bytesToHex(byte[] data) |
static byte[] |
compress(String string)
Compress a String to GZIP data
|
static byte[] |
concatenateByteArrays(byte[] a,
byte[] b)
Concatenates two byte arrays
From: http://stackoverflow.com/questions/5368704/appending-byte-to-the-end-of-another-byte
|
static String |
decompress(byte[] compressed)
Decompress GZIP data to a String
|
static boolean |
hasPermission(Context context,
String permission) |
static byte[] |
hexToBytes(String str) |
static void |
log(String message) |
static String |
md5(String s) |
static String |
readStream(InputStream stream)
Reads an InputStream and converts it to a String
|
static String |
sha1(String s) |
static String |
sha256(String s) |
public static void log(String message)
public static String readStream(InputStream stream) throws IOException
stream
- InputStream to readIOException
- Reader was closed when trying to be readUnsupportedEncodingException
- UTF-8 encoding could not be foundpublic static String bytesToHex(byte[] data)
data
- Byte array to convert to hexpublic static byte[] hexToBytes(String str)
str
- Hex string to convert to bytespublic static String sha1(String s)
s
- String to SHA-1 hashpublic static String sha256(String s)
s
- String to SHA-256 hashpublic static byte[] compress(String string) throws IOException
string
- String to compressIOException
public static String decompress(byte[] compressed) throws IOException
compressed
- Data to decompressIOException
public static byte[] concatenateByteArrays(byte[] a, byte[] b)
a
- Byte array ab
- Byte array b