Java handling large text file

I'm trying to access a large text file and handle the data as if it were a string.  I've never had to access a file larger than a few megs, and this is over 100mb.  Any help is appreciated.
LVL 1
pncorpAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Why do you need to access it as a String. Are you sure you do?
0
pncorpAuthor Commented:
It doesn't have to be a String, but I need to be able to create strings by using indexes like I would use to create a substring from a string.  
0
CEHJCommented:
OK. That wouldn't require you to read the whole file into memory fortunately. Just use a RandomAccessFile
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

CEHJCommented:
e.g. to read a String of 64 characters halfway into the file:
RandomAccessFile raf = new RandomAccessFile("x.txt", "r");
raf.seek(raf.length() / 2);
byte[] buffer = new byte[64];
raf.read(buffer);
String s = new String(buffer);

Open in new window

0
pncorpAuthor Commented:
So how would I create a string from charcter 1000 - 1050?
0
CEHJCommented:
Seek to 1000 and create a buffer of size 50
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pncorpAuthor Commented:
Thanks, you're awesome!
0
CEHJCommented:
:-)
0
CEHJCommented:
:-)

Actually, you should use readFully, not read
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.