File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes beginnig of the file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "beginnig of the file" Watch "beginnig of the file" New topic
Author

beginnig of the file

Andrew Lit
Ranch Hand

Joined: Jul 01, 2002
Posts: 135
is there a way to determine if i am at the beginning of the file?
is there a symbol like EOF or smth like that?
thank you
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Not really. If you're using streams, then when you've just opened the FileInputStream (or Reader) and haven't yet read anything, you're at the beginning. After that, you're not. If you're using RandomAccessFile, you can use the poorly-named getFilePointer() method to find out how many bytes you are from the beginning of the file.
It's also possible to create your own custom FilterInputStream or FilterReader which counts how many bytes (for InputStreams) or chars (for Readers) have been read, and provides an extra method to access this info.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: beginnig of the file
 
Similar Threads
making java program user friendly
Tomcat startup error
CD Rom auto run
taglib URI question
CD Rom auto run