use of java.io.FilenameFilter in project android_frameworks_base by ParanoidAndroid.
the class VideoDumpView method onResume.
@Override
public void onResume() {
Log.d(TAG, "onResume");
mMediaPlayer = new MediaPlayer();
try {
mMediaPlayer.setDataSource(VideoDumpConfig.VIDEO_URI);
class RGBFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
return (name.endsWith(VideoDumpConfig.IMAGE_SUFFIX));
}
}
File dump_dir = new File(VideoDumpConfig.ROOT_DIR);
File[] dump_files = dump_dir.listFiles(new RGBFilter());
for (File dump_file : dump_files) {
dump_file.delete();
}
File image_list = new File(VideoDumpConfig.ROOT_DIR + VideoDumpConfig.IMAGES_LIST);
image_list.delete();
mImageListWriter = new BufferedWriter(new FileWriter(image_list));
} catch (java.io.IOException e) {
Log.e(TAG, e.getMessage(), e);
}
queueEvent(new Runnable() {
public void run() {
mRenderer.setMediaPlayer(mMediaPlayer);
mRenderer.setImageListWriter(mImageListWriter);
}
});
super.onResume();
}
use of java.io.FilenameFilter in project android_frameworks_base by ParanoidAndroid.
the class PackageManagerService method deleteTempPackageFiles.
private void deleteTempPackageFiles() {
final FilenameFilter filter = new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.startsWith("vmdl") && name.endsWith(".tmp");
}
};
deleteTempPackageFilesInDirectory(mAppInstallDir, filter);
deleteTempPackageFilesInDirectory(mDrmAppPrivateInstallDir, filter);
}
use of java.io.FilenameFilter in project GT by Tencent.
the class LogController method setLastestLogFileAsCurFile.
private void setLastestLogFileAsCurFile() {
// 遍历日志文件夹中的日志文件,取最新的为当前写目标
if (!curLogFolder.exists()) {
curLogFolder.mkdirs();
}
// 过滤出合法的日志文件
File[] files = curLogFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String filename) {
return filename.matches(LogUtils.LOG_FILE_MATCHE);
}
});
// 按修改时间排序
if (null != files && files.length > 0) {
Arrays.sort(files, 0, files.length, new Comparator<File>() {
@Override
public int compare(File lhs, File rhs) {
return lhs.lastModified() <= rhs.lastModified() ? 1 : -1;
}
});
// 取最新的文件为当前文件
curFile = files[0];
} else {
curFile = new File(curLogFolder, 00 + LogUtils.LOG_POSFIX);
}
}
use of java.io.FilenameFilter in project GT by Tencent.
the class GTGPSUtils method getGPSFileList.
public static ArrayList<String> getGPSFileList() {
ArrayList<String> arrFile = new ArrayList<String>();
try {
File[] files = Env.ROOT_GPS_FOLDER.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String filename) {
if (filename != null && filename.endsWith(".gps")) {
return true;
}
return false;
}
});
if (files != null) {
// 文件个数
int count = files.length;
for (int i = 0; i < count; i++) {
File file = files[i];
arrFile.add(file.getName());
}
} else {
arrFile.add("empty");
}
} catch (Exception ex) {
ex.printStackTrace();
}
return arrFile;
}
use of java.io.FilenameFilter in project ice by Netflix.
the class MapDb method upload.
void upload() {
AmazonS3Client s3Client = AwsUtils.getAmazonS3Client();
File dir = new File(config.localDir);
File[] files = dir.listFiles(new FilenameFilter() {
public boolean accept(File file, String fileName) {
return fileName.startsWith(dbName);
}
});
for (File file : files) s3Client.putObject(config.workS3BucketName, config.workS3BucketPrefix + file.getName(), file);
for (File file : files) s3Client.putObject(config.workS3BucketName, config.workS3BucketPrefix + "copy" + file.getName(), file);
}
Aggregations