aspose file tools*
The moose likes I/O and Streams and the fly likes what is the most optimized way of writing a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "what is the most optimized way of writing a file" Watch "what is the most optimized way of writing a file" New topic
Author

what is the most optimized way of writing a file

Biren shah
Ranch Hand

Joined: Apr 13, 2005
Posts: 107
hi friends,
i do write a file..and some times read them also.
i want a tutorial or way of writing the file in most optimized way


Biren Shah<br />scjp 93%<br />scwcd 1.4 92%
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Java Platform Performance has a chapter on IO. Be aware that there is no one answer to your question. It depends on a large number of factors.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Biren shah
Ranch Hand

Joined: Apr 13, 2005
Posts: 107
thanks Ess
this will really help
Biren shah
Ranch Hand

Joined: Apr 13, 2005
Posts: 107
thanks Ess
this will really help
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
I believe the faster way to access a file (read/write) is using the java.nio.MappedByteBuffer obtained from a FileChannel.

For instance:



It is the most direct way to access the file and therefore should be the faster.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the most optimized way of writing a file