aspose file tools*
The moose likes I/O and Streams and the fly likes IO Performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "IO Performance" Watch "IO Performance" New topic
Author

IO Performance

Steve Grant
Ranch Hand

Joined: Nov 24, 2003
Posts: 106
Dear Sir,
I am using BufferedOutptStream class to write byte array to a file. Is there any other way to write to the file in a more effecient way in java
. i have my own class called VFSIOService which has the methods addFile and copyFile which are responsible for writing and copying. This class is called by a stateless session ejb VFSFacade. Many users will be uploading their files by calling addFile method on the EJB and also copy their files from source to destination.
The addFile method receives a byte array . Here I am using BufferedOutputStream to write this byte array to the file on hard disk. Is this right approach or is there any other approach which could improve the performance. Following is the sample code of addFile:
addFile(FileTO fileTO) throws Exception
{
BufferedOutputStream out = new BufferedOutputStream( new FileOutputStream("c:/tmp.txt"));
byte b [] = fileTO.getFileBytes();
out.write(b);
out.close();
}
Similarly I am using BuffereInputStream n OutputStream for copying a file from source to destination. My project will be on linux system and so i was thinking about using Runtime.exec method to call linux cp (copy) command which will be resposible for copying the file from source to destination. I thought of this bcuz this will be much faster than using BufferedInputStream n OutputStream . Is there any harm of using above approach.
thx & rgds
Siddharth K


SCJP1.4<br />IBM Certified System Administrator -- WebSphere Application Server V5.0 (340)
 
 
subject: IO Performance