String s = "字符串"
直接调用 s.getByte() 就会返回一个byte[] 数组.
getByte还可以传递一个字符编码例如: s.getByte("UTF-8") s.getByte("GBK")
byte是十进制的数字。。给你看个例子:
public class Test {
public static void main(String[] args) {
String str = "b"
byte[] bytes = str.getBytes()
for(byte b:bytes){
System.out.println(b)
System.out.println(Integer.toBinaryString(b))
}
}
}
public static void AppendBytesToFile(this Byte[] fileBytes, string fileName){
FileStream fileStream = new FileStream(fileName, FileMode.Append, FileAccess.ReadWrite)
fileStream.Write(fileBytes, 0, fileBytes.Length)
fileStream.Close()
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)