I am trying to read the number of line in a binary file using readObject, but I get IOException EOF. Am I doing this the right way?
    FileInputStream istream = new FileInputStream(fileName);
    ObjectInputStream ois = new ObjectInputStream(istream);
    /** calculate number of items **/
    int line_count = 0;
    while( (String)ois.readObject() != null){            
        line_count++;
    }