We are about to switch to a new forum software. Until then we have removed the registration on this forum.
import java.nio.file.*;
import java.io.*;
import static java.nio.file.StandardOpenOption.*;
void fwrite(String filename, byte[] data, boolean append){
Path file = Paths.get(filename);
OutputStream output = null;
try
{
if(append){
output = new BufferedOutputStream(Files.newOutputStream(file, APPEND));
}
else{
output = new BufferedOutputStream(Files.newOutputStream(file, CREATE));
}
output.write(data);
output.flush();
output.close();
}
catch(Exception e)
{
System.out.println("Message: " + e);
}
}
Comments
what is the question???
it's 'share your work' - there is no question
or documentation