由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - ERROR!java.io.RandomAccessFile.readInt
相关主题
java synchronized 问题 (转载)Urgent!
一个多线程问题BufferedWriter里的write()
再问一个how to read registry key value using java (64-bit system)
java 随机数 nextInt(int n)的问题这段程序的输出是什么? 为什么
How to append something on a file?问个简单的Java技术问题
Get error while compling, need helpSpringMVC可否直接处理doGet?
JNI 诡异问题求教在线等,
Help! ClassCastExceptionAsk a simple question about throw exception, bow bow bow
相关话题的讨论汇总
话题: string话题: error话题: file话题: persian话题: read
进入Java版参与讨论
1 (共1页)
G*********a
发帖数: 1080
1
it's really wired, i have a file of strings, and has methods such as
getString(int), getInt(String)... it worked fine before but today it keeps
throwing this error: java.io.EOFException
at java.io.RandomAccessFile.readInt(RandomAccessFile.java:705)
i didn't change any code of that part, and the file could be read into and
printout well, all the other String works fine, except. one is "persian"...
anyone knows the possible reason?
Thanks!
G*********a
发帖数: 1080
2
found the error only happened on the last String of the saved file when using
getString(int no)... still can't finger out yet... //thinking...

【在 G*********a 的大作中提到】
: it's really wired, i have a file of strings, and has methods such as
: getString(int), getInt(String)... it worked fine before but today it keeps
: throwing this error: java.io.EOFException
: at java.io.RandomAccessFile.readInt(RandomAccessFile.java:705)
: i didn't change any code of that part, and the file could be read into and
: printout well, all the other String works fine, except. one is "persian"...
: anyone knows the possible reason?
: Thanks!

m******t
发帖数: 2416
3
Looks like you are trying to use readInt to read a string "persian".
See the javadoc.

【在 G*********a 的大作中提到】
: found the error only happened on the last String of the saved file when using
: getString(int no)... still can't finger out yet... //thinking...

G*********a
发帖数: 1080
4
no, every string has a id, it should find the string according to the given
id, the id is integer.

using
keeps
and
"persian"...

【在 m******t 的大作中提到】
: Looks like you are trying to use readInt to read a string "persian".
: See the javadoc.

g*****g
发帖数: 34805
5
You'd better provide the piece of readInt(String) code
and the format of your text file, or nobody can help
you out. To me you are trying to read beyond EOF.

【在 G*********a 的大作中提到】
: no, every string has a id, it should find the string according to the given
: id, the id is integer.
:
: using
: keeps
: and
: "persian"...

G*********a
发帖数: 1080
6
thanks! bug corrected! it's the binary search algorithm doesn't work properly,
it read one string length over the end of the file.
Thanks everyone!
goodbug, u r cool!

given

【在 g*****g 的大作中提到】
: You'd better provide the piece of readInt(String) code
: and the format of your text file, or nobody can help
: you out. To me you are trying to read beyond EOF.

B******N
发帖数: 445
7
why not use java Properties?

properly,

【在 G*********a 的大作中提到】
: thanks! bug corrected! it's the binary search algorithm doesn't work properly,
: it read one string length over the end of the file.
: Thanks everyone!
: goodbug, u r cool!
:
: given

G*********a
发帖数: 1080
8
where? and how? @@

【在 B******N 的大作中提到】
: why not use java Properties?
:
: properly,

B******N
发帖数: 445
9
i read your post it's like you have a property file:
propty file format should be like this
key=value
if it's the file format, using java.util.Properties API will be very easy. If
not then it's different story.

the
"persian".

【在 G*********a 的大作中提到】
: where? and how? @@
1 (共1页)
进入Java版参与讨论
相关主题
Ask a simple question about throw exception, bow bow bowHow to append something on a file?
Re: Need Emergent help for Java I/O!Get error while compling, need help
java source code analyzing toolJNI 诡异问题求教
help: cannot generate index.html using javadocHelp! ClassCastException
java synchronized 问题 (转载)Urgent!
一个多线程问题BufferedWriter里的write()
再问一个how to read registry key value using java (64-bit system)
java 随机数 nextInt(int n)的问题这段程序的输出是什么? 为什么
相关话题的讨论汇总
话题: string话题: error话题: file话题: persian话题: read