RandomAccessFile is constructed as "rw" If you open with RAF, if the file does not exist, it will create a new file. FileOutputStream: (low level output stream) There are 4 constructors in this class. One takes the FileDescriptor object (which represents an already existing connection to an actual file). This one will not create a new file. Remaining three constructors [one takes the file name as String, one takes the file name as String with another boolean parameter (whether to append or not), third one takes the file name as File] will create a new empty file, if does not exist. If a file can not be created, then all the three will throw FileNotFoundException. All the four constructors will throw SecurityException when the call to checkWrite() denies permission to write So, the answers are RAF and FileOutputStream. Uma
Joined: Nov 25, 2001
So detailedly explanans of UMA is!! Thanks a lot~~~~!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Why FileOutputStream cann't create an empty file in following statement