java DataOutputStream和DataInputStream

版权声明:转载请注明来源 https://blog.csdn.net/genghaihua/article/details/89468338

在IO包中提供了两个与平台无关的数据操作流

数据输出流:DataOutputStream

数据输入流:DataInputStream

A data output stream lets an application write primitive Java data
 types to an output stream in a portable way. An application can
 then use a data input stream to read the data back in.


 void writeByte(int v) 
          将一个 byte 值以 1-byte 值形式写出到基础输出流中。
 void writeShort(int v) 
          将一个 short 值以 2-byte 值形式写入基础输出流中,先写入高字节。 
 void writeInt(int v) 
          将一个 int 值以 4-byte 值形式写入基础输出流中,先写入高字节。 
 void writeLong(long v) 
          将一个 long 值以 8-byte 值形式写入基础输出流中,先写入高字节。 
 void writeFloat(float v) 
          使用 Float 类中的 floatToIntBits 方法将 float 参数转换为一个 int 值,
          然后将该 int 值以 4-byte 值形式写入基础输出流中,先写入高字节。
 void writeDouble(double v) 
          使用 Double 类中的 doubleToLongBits 方法将 double 参数转换为一个 long 值,
          然后将该 long 值以 8-byte 值形式写入基础输出流中,先写入高字节。 
 void writeChar(int v) 
          将一个 char 值以 2-byte 值形式写入基础输出流中,先写入高字节。 
 void writeBoolean(boolean v) 
          将一个 boolean 值以 1-byte 值形式写入基础输出流。
 

猜你喜欢

转载自blog.csdn.net/genghaihua/article/details/89468338
今日推荐