Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-16-2007, 10:16 PM
ShoeNinja's Avatar
Senior Member
 
Join Date: Oct 2007
Posts: 123
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
BufferedReader .mark(int readAheadLimit)
I've been working on a file management class and would like to establish a permanent mark at the beginning of the file. I've been running into problems with the readAheadLimit. It's easy to go over while traversing the file.

Does anyone know how to establish a permanent mark at the beginning of the file to return to? I've considered remarking the file during certain method calls but this seems to be wasteful.

Thanks in advance.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-16-2007, 11:58 PM
ShoeNinja's Avatar
Senior Member
 
Join Date: Oct 2007
Posts: 123
ShoeNinja is on a distinguished road
Send a message via AIM to ShoeNinja
Here's one of the constructors for my class:

Code:
public FileBrowser(File readIt){ try{ this.f = readIt; this.fr = new FileReader(f); this.br = new BufferedReader(fr); br.mark((int)f.length() * 10); }catch (Exception e){ System.out.println("Problem creating FileBrowser " + e.toString()); } }
The problem is with the mark method. The int passed to it is the number of bytes the BufferedReader can read before it loses the mark. Since I have methods that jump all over the file, the BufferedReader eventually exceeds this number and throws an an exception. Anybody have any experience with this?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mark thread RESOLVED. Eranga Suggestions & Feedback 45 04-02-2008 11:34 AM
how u rotate the arrow mark as the line moves accordingly sandhyau AWT / Swing 1 02-17-2008 12:22 AM
how to draw an arrow mark using java swing sandhyau AWT / Swing 5 02-07-2008 12:52 PM
How to use BufferedReader? ProgramBeginner New To Java 2 11-04-2007 10:08 AM
Help with BufferedReader in java carl New To Java 2 07-31-2007 08:20 AM


All times are GMT +3. The time now is 06:13 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org