使用DataOutputStream将字节写入文件
/* from 时 代 J a v a */ import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void main(String[] args) { String strFilePath = "C://Folder//WriteByte.txt"; try { //create FileOutputStream object FileOutputStream fos = new FileOutputStream(strFilePath); DataOutputStream dos = new DataOutputStream(fos); /* NowJava.com - 时 代 Java */ int i = 1; dos.writeByte(i);