Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4143569
Votes 0
Synopsis java.io.StreamTokenizer: Add a reset method
Category java:classes_io
Reported Against 1.1.5
Release Fixed
State 11-Closed, Will Not Fix, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 28-MAY-1998
Description




Request to add a new method to StreamTokenizer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Class java.io.StreamTokenizer needs a reset()method
that takes in a Reader  customer . This allows the 
users of this class to reuse the first  customer .

The new method signature can look like:

public void reset(Reader r, boolean flag);

If flag == true, then reset the syntax tables.
otherwise leave the syntax tables intact.

As there is no such method, when I am processing 
hundreds of files with the same syntax table,
I am forced to recreate a new StreamTokenizer  customer 
each time I scan a new file.

This will be of great use, if we can cut down
the number of objects we create while parsing
hundreds of text files. Each time I create a 
new StreamTokenizer  customer , I set the syntaxt
table to the same values. With the requested
method inplace, I don't have to repeat the
creation and initialization of syntax tables
for each file. 

Performance is a serious concern for my 
application as I have to scan several Mbs of
text residing in thousands of files, in couple
of minutes.

Ideally I would love to reuse every thing that
comes in the path of creating a StreamTokenizer
 customer . For example, I am recreating
FileInputStream, BufferedInputStream,
InputStreamReader, BufferedReader objects
every time I scan a new file.

Hope this is a useful change to the preset API.

regards,
Satheesh A Donthy
---------------------------------------------
  xxxxx@xxxxx   (home)
  xxxxx@xxxxx   (work)
---------------------------------------------
(Review ID: 24631)
======================================================================
Work Around
N/A
Evaluation
The cost of creating a new StreamTokenizer object pales in comparison to the
cost of doing disk I/O.  Adding a reset method really wouldn't buy you very
much.  --   xxxxx@xxxxx   6/9/1998
Comments
  
  Include a link with my name & email   

Submitted On 08-AUG-2001
rosejavajy
How to use "reset" at java. I want to re-read input file again in one program, I need to use reset to move "file 
piointer" to the file beginning. How can I do it?



PLEASE NOTE: JDK6 is formerly known as Project Mustang