ConvertUtils

class ConvertUtils
    author: Blankj
    blog  : http://blankj.com
    time  : 2016/08/13
    desc  : utils about convert

Functions

bitmap2Bytes
Link copied to clipboard
open fun bitmap2Bytes(bitmap: Bitmap, format: Bitmap.CompressFormat): Array<Byte>
Bitmap to bytes.
bitmap2Drawable
Link copied to clipboard
open fun bitmap2Drawable(bitmap: Bitmap): Drawable
Bitmap to drawable.
bits2Bytes
Link copied to clipboard
open fun bits2Bytes(bits: String): Array<Byte>
Bits to bytes.
byte2FitMemorySize
Link copied to clipboard
open fun byte2FitMemorySize(byteSize: Long): String
Size of byte to fit size of memory.
byte2MemorySize
Link copied to clipboard
open fun byte2MemorySize(byteSize: Long, unit: Int): Double
Size of byte to size of memory in unit.
bytes2Bitmap
Link copied to clipboard
open fun bytes2Bitmap(bytes: Array<Byte>): Bitmap
Bytes to bitmap.
bytes2Bits
Link copied to clipboard
open fun bytes2Bits(bytes: Array<Byte>): String
Bytes to bits.
bytes2Chars
Link copied to clipboard
open fun bytes2Chars(bytes: Array<Byte>): Array<Char>
Bytes to chars.
bytes2Drawable
Link copied to clipboard
open fun bytes2Drawable(bytes: Array<Byte>): Drawable
Bytes to drawable.
bytes2HexString
Link copied to clipboard
open fun bytes2HexString(bytes: Array<Byte>): String
Bytes to hex string.
bytes2InputStream
Link copied to clipboard
open fun bytes2InputStream(bytes: Array<Byte>): InputStream
Bytes to input stream.
bytes2OutputStream
Link copied to clipboard
open fun bytes2OutputStream(bytes: Array<Byte>): OutputStream
Bytes to output stream.
chars2Bytes
Link copied to clipboard
open fun chars2Bytes(chars: Array<Char>): Array<Byte>
Chars to bytes.
drawable2Bitmap
Link copied to clipboard
open fun drawable2Bitmap(drawable: Drawable): Bitmap
Drawable to bitmap.
drawable2Bytes
Link copied to clipboard
open fun drawable2Bytes(drawable: Drawable, format: Bitmap.CompressFormat): Array<Byte>
Drawable to bytes.
hexString2Bytes
Link copied to clipboard
open fun hexString2Bytes(hexString: String): Array<Byte>
Hex string to bytes.
input2OutputStream
Link copied to clipboard
open fun input2OutputStream(is: InputStream): ByteArrayOutputStream
Input stream to output stream.
inputStream2Bytes
Link copied to clipboard
open fun inputStream2Bytes(is: InputStream): Array<Byte>
Input stream to bytes.
inputStream2String
Link copied to clipboard
open fun inputStream2String(is: InputStream, charsetName: String): String
Input stream to string.
memorySize2Byte
Link copied to clipboard
open fun memorySize2Byte(memorySize: Long, unit: Int): Long
Size of memory in unit to size of byte.
millis2FitTimeSpan
Link copied to clipboard
open fun millis2FitTimeSpan(millis: Long, precision: Int): String
Milliseconds to fit time span.
millis2TimeSpan
Link copied to clipboard
open fun millis2TimeSpan(millis: Long, unit: Int): Long
Milliseconds to time span in unit.
output2InputStream
Link copied to clipboard
open fun output2InputStream(out: OutputStream): ByteArrayInputStream
Output stream to input stream.
outputStream2Bytes
Link copied to clipboard
open fun outputStream2Bytes(out: OutputStream): Array<Byte>
Output stream to bytes.
outputStream2String
Link copied to clipboard
open fun outputStream2String(out: OutputStream, charsetName: String): String
Output stream to string.
string2InputStream
Link copied to clipboard
open fun string2InputStream(string: String, charsetName: String): InputStream
String to input stream.
string2OutputStream
Link copied to clipboard
open fun string2OutputStream(string: String, charsetName: String): OutputStream
String to output stream.
timeSpan2Millis
Link copied to clipboard
open fun timeSpan2Millis(timeSpan: Long, unit: Int): Long
Time span in unit to milliseconds.
view2Bitmap
Link copied to clipboard
open fun view2Bitmap(view: View): Bitmap
View to bitmap.