Home | History | Annotate | Download | only in com.example.android.autobackupsample

Lines Matching defs:file

5  * you may not use this file except in compliance with the License.
35 import java.io.File;
39 * The purpose of AddFileActivity activity is to create a data file based on the
40 * file name and size parameters specified as an Intent external parameters or with the
58 * The intent parameter that specifies a file name. The file name must be unique for the
64 * The intent parameter that specifies a file size in bytes. The size must be a number
70 * The file storage is an optional parameter. It should be one of these:
76 * A file size multiplier. It is used to calculate the total number of bytes to be added
77 * to the file.
82 * Defines File Storage options.
91 * Contains a selected by a user file storage option.
106 // If an intent has extra parameters, create the file and finish the activity.
139 * A handler function for a Create File button click event.
141 * @param view a reference to the Create File button view.
225 File file = null;
231 file = getInternalFile(fileName);
232 out = openFileOutput(file.getName(), Context.MODE_PRIVATE);
237 File externalAppDir = getExternalFilesDir(null);
238 file = new File(externalAppDir, fileName);
239 out = new FileOutputStream(file);
242 file = new File(getNoBackupFilesDir(), fileName);
243 out = new FileOutputStream(file);
247 if (file == null || out == null) {
248 Log.d(TAG, "Unable to create file output stream");
261 String message = String.format("File created: %s, size: %s bytes",
262 file.getAbsolutePath(), sizeInBytes);
289 File file = getInternalFile(fileName);
290 if (file.exists()) {
292 Log.d(TAG, "This file exists: " + file.getName());
305 Log.d(TAG, "Invalid file size: " + sizeInBytesParamValue);
310 // Validate file size value. It should be 0 or a positive number.
313 Log.d(TAG, "Invalid file size: " + sizeInBytes);
325 Log.d(TAG, "Invalid file storage: " + fileStorage);
332 private File getInternalFile(String fileName) {
333 File internalAppDir = getFilesDir();
334 return new File(internalAppDir, fileName);