Get EOF character

Discussion in 'Java' started by Manish Hatwalne, Jul 22, 2004.

  1. I sit possible to get an EOF character for a plain text file (^Z etc) in my
    Java code using some system property (something like "file.separator").
    I know how to read file, but I need this EOF character for some other
    purpose. How can I get this?

    TIA,
    - Manish
     
    Manish Hatwalne, Jul 22, 2004
    #1
    1. Advertisements

  2. Manish Hatwalne

    Carl Howells Guest

    There's no such thing as an EOF character. The end of a file isn't
    marked by any kind of special character. The end of the file is
    determined by the entry in the file system that stores the length of the
    file.

    You'll have to find a different way to solve the problem. Do you want
    multiple files? Do you want a single file with multiple sections?
     
    Carl Howells, Jul 22, 2004
    #2
    1. Advertisements

  3. BTW, I tried this and found that there's no system property as such, is
    there any other way of getting it?
    System.getProperties().list(System.out);

    TIA,
    - Manish
     
    Manish Hatwalne, Jul 22, 2004
    #3
  4. Manish Hatwalne

    Hal Rosser Guest

    if you try a read and get null, then you're at end of file
     
    Hal Rosser, Jul 22, 2004
    #4
  5. Manish Hatwalne

    Roedy Green Guest

    public static final char EOF = (char)26;
     
    Roedy Green, Jul 22, 2004
    #5
  6. Manish Hatwalne

    Roedy Green Guest

    the EOF character has no special meaning in Java. It did in CPM and
    sometimes in DOS, but generally it is not used anymore. The OS tracks
    the exact length of a file and puts no marker character in.
     
    Roedy Green, Jul 22, 2004
    #6
  7. Manish Hatwalne

    Roedy Green Guest

    or an EOFException
    or a -1
    or ...

    Java is worse that French verbs in irregularity.
     
    Roedy Green, Jul 22, 2004
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.