如何从文件读固定格式的数据,像在C中一样.急!在线...............
我要从一个文件中的每一行读一些数据,然后呢,这些行中的数据以空格或者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




