File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

beginnig of the file

 
Andrew Lit
Ranch Hand
Posts: 135
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic