OutputStream类中的三种write方法

OutputStream类中的三种write方法

01OutputStream类中的三种write方法     public     abstract     int   write(int b)     throws IOException


  • (来源,输出内容)参数b的低八位字节(去处)写入此输出流中int类型是32位的)

  • 和InputStream中的无参read()方法相对应

OutputStream类中的三种write方法


OutputStream类中的三种write方法


02OutputStream类中的三种write方法public int write(byte [] b) throws IOException
  • write(byte [] b)和 write(b, 0, b.length)有完全相同的效果

  • 所以具体的看write(byte [] b ,int off , int len)方法

OutputStream类中的三种write方法


03OutputStream类中的三种write方法public int write(byte [] b , int off  , int  len)         throws IOException

  • 将字节数组b中的第off+1个元素开始的len个数据。顺序的写入此输出流中

  • write()方法所写的数据并没有直接传到输出流相连中的外设上,而是先暂时的存放在流的缓冲区中,等到缓冲区的数据积累到一定数量,再执行一次向外设的写操作把它们全部写到外设上

OutputStream类中的三种write方法




相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-26
  • 2021-10-08
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案