Skip to main content

Database sampling

1 reply [Last post]
Joined: 2006-02-17

I have a 700,000 line ascii database. I need to sample the data into a smaller file (maybe 700 lines). I want this to be a reasonably sampling The only idea I have right now is to use readLine() with a BufferedReader. However, this means my code has to look at every line... Is there a way I can tell readLine() to only look at, say, every 100 or 1000 lines?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-13

I suggest creating a FileReader and reading per byte (building your own line using a StringBuffer)
Then using a seek with an estimated length to skip over a lot of lines.