Android examples for java.io:File
create File for number of bytes
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; public class Main{ public static void createFile(File file, int numBytes) throws IOException { File parentFile = file.getParentFile(); if (parentFile != null) { parentFile.mkdirs();/* www. j a v a 2 s.c o m*/ } byte[] buffer = new byte[numBytes]; FileOutputStream output = new FileOutputStream(file); try { output.write(buffer); } finally { output.close(); } } }