java第十章总结

文件执行

Runtime ec = Runtime.getRuntime();

ec.exec(String command);

文件字节输入流

try{

FileInputStream in = new FileInputStream("hello.txt");}

catch(IOException e){}

int read();int read(byte b[]);int read(byte b[],int off,int len);

输出

File f=new File("abc.txt");

FileOutputStream out=new FileOutputStream (f);

void write(int b);void write(byte[] array);void write(byte[] array, int offset, int length); void close();

文件字符输入输出流

FileReader FileWriter

缓冲流

BufferedReader      读取一行 readLine();

数据流 

DataInputStream

 public String readUTF();  读入一个已使用UTF-8修改版格式编码的字符串

 public String readLine(); 

 public boolean readBoolean;  

 public int readInt();  

 public byte readByte();  

 public char readChar();  等等一系列读取基本数据类型的方法

如果发生I/O类型错误,会抛出IOException类型的异常。

DataOutputStream

    public void writeBoolean(boolean b);  将一个boolean值以1-byte形式写入基本输出流。

 public void writeByte(int v);  将一个byte值以1-byte值形式写入到基本输出流中。

 public void writeBytes(String s);  将字符串按字节顺序写入到基本输出流中。

 public void writeChar(int v);  将一个char值以2-byte形式写入到基本输出流中。先写入高字节。

 public void writeInt(int v);  将一个int值以4-byte值形式写入到输出流中先写高字节。

 public void writeUTF(String str); 

 public int size();  返回written的当前值。

如果发生I/O类型错误,会抛出IOException类型的异常。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值