个人认为:没有太大区别,write(int)主要是写入并且转换一种类型,而writeByte(int v)就是说利用字节型把变量V定义的INT型作用出来.

解决方案 »

  1.   

    肯定有区别啊,不然要2个函数干嘛
    我怎么觉得writeByte(int v)会丢失数据啊,而write(int b)说是写的低8位,也会丢失数据,到底有什么区别啊
      

  2.   

    前者:public void write(int b)
               throws IOException
    Writes the specified byte (the low eight bits of the argument b) to the underlying output stream. If no exception is thrown, the counter written is incremented by 1.
    后者:public final void writeByte(int v)
                         throws IOException
    Writes out a byte to the underlying output stream as a 1-byte value. If no exception is thrown, the counter written is incremented by 1.
    这是JDK的文档的解释,看看就知道了。
    实际效果没什么不一样的吧。
      

  3.   

    write(int)是一次写入一个int,四个字节,
    writeByte(int v)是一次写入一个字节,实际上每个字节就是一个整型值,由于一次只写入一个字节,因此速度和write(int)比会比较慢,但不会丢失数据。