zoukankan      html  css  js  c++  java
  • 23(java/io/data_io)

    package test_ppt;
    import java.io.*;
    public class test_ppt
    {
    public static void main(String args[]) throws IOException
    {
    FileOutputStream fos = new FileOutputStream("a.txt");
    DataOutputStream dos = new DataOutputStream (fos);
    try
    {//ff
    dos.writeBoolean(true);
    dos.writeByte((byte)123);
    dos.writeChar('J');
    dos.writeDouble(3.141592654);
    dos.writeFloat(2.7182f);
    dos.writeInt(1234567890);
    dos.writeLong(998877665544332211L);
    dos.writeShort((short)11223);
    }
    finally
    {
    dos.close();
    }
    FileInputStream fis = new FileInputStream("a.txt");
    DataInputStream dis = new DataInputStream(fis);
    try
    {
    System.out.println(" "+dis.readBoolean());
    System.out.println(" "+dis.readByte());
    System.out.println(" "+dis.readChar());
    System.out.println(" "+dis.readDouble());
    System.out.println(" "+dis.readFloat());
    System.out.println(" "+dis.readInt());
    System.out.println(" "+dis.readLong());
    System.out.println(" "+dis.readShort());
    }
    finally
    {
    dis.close();
    }
    }//main()
    }//class DataStream

  • 相关阅读:
    【转】awk内置变量
    【转】awk数组操作
    【转】awk 数组用法【精华贴】
    【转】linux shell 逻辑运算符、逻辑表达式
    指挥作战
    人脸相关
    TD
    后台
    前台 html 空格
    linux
  • 原文地址:https://www.cnblogs.com/acm-icpcer/p/6579555.html
Copyright © 2011-2022 走看看