这是java输入流的使用语法格式,可以作为参考的类型
public class InputStream {
public static void main(String[] args) {
File file = new File("C:\\Example1.txt");
try {
if (!file.exists()) {
file.createNewFile();
}
FileInputStream ff = new FileInputStream(file);
byte[] bs = new byte[1024];
StringBuilder sbBuilder = new StringBuilder();
int a;
while ((a = ff.read(bs)) != -1) {
sbBuilder.append(new String(bs, 0, a));
}
ff.close();
System.out.println(sbBuilder);
} catch (IOException e) {
e.printStackTrace();
}
}
}