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

  • 相关阅读:
    英雄大乱斗
    深浅拷贝(copy)
    myleecode
    代码量简单统计
    pandas 模块 05
    matplotlib 模块 07
    KVC 和KVO浅谈
    iOS开发中懒加载的使用和限制
    关于空白模板插件的使用
    UIImageC处理
  • 原文地址:https://www.cnblogs.com/acm-icpcer/p/6579555.html
Copyright © 2011-2022 走看看