CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Java >  J2SE / 基础类

如何从文件读固定格式的数据,像在C中一样.急!在线...............

楼主sethyhm(sethyhm)2004-05-03 22:57:25 在 Java / J2SE / 基础类 提问

我要从一个文件中的每一行读一些数据,然后呢,这些行中的数据以空格或者TAB分隔,数据可以是int,float,double,char的混和,JAVA中有这样已经写好的函数吗???? 问题点数:0、回复次数:4Top

1 楼sean_gao(大胃 http://gaoyuxiang.cn/)回复于 2004-05-03 23:49:41 得分 0

RandomAccessFile?Top

2 楼dogcai(dogcai)回复于 2004-05-04 07:47:00 得分 0

楼主可以用ObjectFileWriter或者DataOutputStream。。这两种类里面提供不同得数据写入和写出的功能。。你看一下帮助文档就明白我的意思了。。Top

3 楼dogcai(dogcai)回复于 2004-05-04 07:48:41 得分 0

当然你所使用的这个文档也要用相应的输入流操纵。。Top

4 楼ac669(让心情去旅行)回复于 2004-05-04 12:10:57 得分 0

java.io    
  Class   DataInputStream  
  java.lang.Object  
      |  
      +--java.io.InputStream  
                  |  
                  +--java.io.FilterInputStream  
                              |  
                              +--java.io.DataInputStream  
   
  All   Implemented   Interfaces:    
  DataInput    
   
   
   
  int   read(byte[]   b)    
                      Reads   some   number   of   bytes   from   the   contained   input   stream   and   stores   them   into   the   buffer   array   b.    
    int   read(byte[]   b,   int   off,   int   len)    
                      Reads   up   to   len   bytes   of   data   from   the   contained   input   stream   into   an   array   of   bytes.    
    boolean   readBoolean()    
                      See   the   general   contract   of   the   readBoolean   method   of   DataInput.    
    byte   readByte()    
                      See   the   general   contract   of   the   readByte   method   of   DataInput.    
    char   readChar()    
                      See   the   general   contract   of   the   readChar   method   of   DataInput.    
    double   readDouble()    
                      See   the   general   contract   of   the   readDouble   method   of   DataInput.    
    float   readFloat()    
                      See   the   general   contract   of   the   readFloat   method   of   DataInput.    
    void   readFully(byte[]   b)    
                      See   the   general   contract   of   the   readFully   method   of   DataInput.    
    void   readFully(byte[]   b,   int   off,   int   len)    
                      See   the   general   contract   of   the   readFully   method   of   DataInput.    
    int   readInt()    
                      See   the   general   contract   of   the   readInt   method   of   DataInput.    
   
   
  ...Top

相关问题

  • C#写入带格式的EXCEL文件??
  • 怎么样使用C#把bmp格式文件转换成jpg格式文件?
  • C#如何将HTML文件转换成MHT格式的文件
  • 固定格式的文件如何存取
  • 固定文本文件格式处理问题
  • 文件格式??
  • 文件格式?
  • 文件格式
  • 文件格式
  • 求救!怎样用C++显示 .BMP格式的文件!

关键词

  • 数据
  • datainput
  • contract
  • readfully
  • method
  • byte
  • io
  • len
  • reads

得分解答快速导航

  • 帖主:sethyhm

相关链接

  • CSDN Java频道
  • Java类图书
  • Java类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo