• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

strreams 4 massive file?

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello buddies,

Which Interface(Streams) is best to handle very big document file(Ex:- .DOC file of size 50MB)?

thanks,

regards,
Mahesh P
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends what you want to do with it. If you don't need to read the whole thing at a time then look at RandomAccessFile which allows you to jump in at a particular byte offset and start reading. I use this on very large files (GB's) to read small sections st a time.
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK Mr. Wood, what if i want to just open the file and display the output or just copy the contents to other files?

thanks 4 ur reply.
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then I guess you would need to look at something like FileInputStream which shouldn't have a problem reading a large file...the limitation will be how much of that file you need to keep in memory to do something with it. A stream itself should not use the memory up as it reads. What sort of file are you trying to read - ASCII or binary?
 
Mahesh Pinnamaneni
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tell me in both situations.like if i want to use both ascii and binary formats(source codes in two java files).
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then for the ASCII file consider using java.io.FileReader, which reads in a line at a time as a String and is easy to use. I tend to use along with BufferedReader something like this...

reply
    Bookmark Topic Watch Topic
  • New Topic