What do you mean by "File Objects"; you mean java.io.File?
A class java.io.Fileis simply a representation of the directory name and file name. This is not an object that may contain the contents of a file.
If you have data, for example, in an array of bytes, then yes, you can save this in a file:
byte[] data = ...;
OutputStream out = new FileOutputStream(new File("C:\\someplace\\filename.dat"));
out.write(data);
out.close();
Check out Basic I / O Lesson from Oracle Java Tutorials to learn how to read and write files using FileInputStreamand FileOutputStream.
source
share