public class SimpleByteSource extends Object implements ByteSource, Serializable
ByteSource.Util| 构造器和说明 |
|---|
SimpleByteSource(byte[] bytes) |
SimpleByteSource(ByteSource source)
Creates an instance using the sources bytes directly - it does not create a copy of the
argument's byte array.
|
SimpleByteSource(char[] chars)
Creates an instance by converting the characters to a byte array (assumes UTF-8 encoding).
|
SimpleByteSource(File file)
Creates an instance by converting the file to a byte array.
|
SimpleByteSource(InputStream stream)
Creates an instance by converting the stream to a byte array.
|
SimpleByteSource(String string)
Creates an instance by converting the String to a byte array (assumes UTF-8 encoding).
|
public SimpleByteSource(byte[] bytes)
public SimpleByteSource(char[] chars)
chars - the source characters to use to create the underlying byte array.public SimpleByteSource(String string)
string - the source string to convert to a byte array (assumes UTF-8 encoding).public SimpleByteSource(ByteSource source)
source - the source to use to populate the underlying byte array.public SimpleByteSource(File file)
file - the file from which to acquire bytes.public SimpleByteSource(InputStream stream)
stream - the stream from which to acquire bytes.public static boolean isCompatible(Object o)
o - the object to test to see if it can be easily converted to bytes by instances of this class.true if the specified object can be easily converted to bytes by instances of this class,
false otherwise.public byte[] getBytes()
getBytes 在接口中 ByteSourcepublic boolean isEmpty()
isEmpty 在接口中 ByteSourcepublic String toHex()
toHex 在接口中 ByteSourcepublic String toBase64()
toBase64 在接口中 ByteSourceCopyright © 2015-2017. All Rights Reserved.