本文整理汇总了Java中brut.util.BrutIO类的典型用法代码示例。如果您正苦于以下问题:Java BrutIO类的具体用法?Java BrutIO怎么用?Java BrutIO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BrutIO类属于brut.util包,在下文中一共展示了BrutIO类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSourcesRaw
import brut.util.BrutIO; //导入依赖的package包/类
public boolean buildSourcesRaw(File appDir, String filename)
throws AndrolibException {
File working = new File(appDir, filename);
if (!working.exists()) {
return false;
}
File stored = new File(appDir, APK_DIRNAME + "/" + filename);
if (apkOptions.forceBuildAll || isModified(working, stored)) {
LOGGER.info("Copying " + appDir.toString() + " " + filename + " file...");
try {
BrutIO.copyAndClose(new FileInputStream(working), new FileOutputStream(stored));
return true;
} catch (IOException ex) {
throw new AndrolibException(ex);
}
}
return true;
}
示例2: copyExistingFiles
import brut.util.BrutIO; //导入依赖的package包/类
private void copyExistingFiles(ZipFile inputFile, ZipOutputStream outputFile) throws IOException {
// First, copy the contents from the existing outFile:
Enumeration<? extends ZipEntry> entries = inputFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = new ZipEntry(entries.nextElement());
// We can't reuse the compressed size because it depends on compression sizes.
entry.setCompressedSize(-1);
outputFile.putNextEntry(entry);
// No need to create directory entries in the final apk
if (! entry.isDirectory()) {
BrutIO.copy(inputFile, outputFile, entry);
}
outputFile.closeEntry();
}
}
示例3: buildSourcesRaw
import brut.util.BrutIO; //导入依赖的package包/类
public boolean buildSourcesRaw(File appDir, HashMap<String, Boolean> flags)
throws AndrolibException {
try {
File working = new File(appDir, "classes.dex");
if (!working.exists()) {
return false;
}
File stored = new File(appDir, APK_DIRNAME + "/classes.dex");
if (flags.get("forceBuildAll") || isModified(working, stored)) {
LOGGER.info("Copying classes.dex file...");
BrutIO.copyAndClose(new FileInputStream(working),
new FileOutputStream(stored));
}
return true;
} catch (IOException ex) {
throw new AndrolibException(ex);
}
}
示例4: copyToDir
import brut.util.BrutIO; //导入依赖的package包/类
public static void copyToDir(Directory in, Directory out, String fileName)
throws DirectoryException {
try {
if (in.containsDir(fileName)) {
// TODO: remove before copying
in.getDir(fileName).copyToDir(out.createDir(fileName));
} else {
BrutIO.copyAndClose(in.getFileInput(fileName),
out.getFileOutput(fileName));
}
} catch (IOException ex) {
throw new DirectoryException(
"复制文件时发生错误: " + fileName, ex);
}
}
示例5: copyUnknownFiles
import brut.util.BrutIO; //导入依赖的package包/类
private void copyUnknownFiles(File appDir, ZipOutputStream outputFile, Map<String, String> files)
throws IOException {
File unknownFileDir = new File(appDir, UNK_DIRNAME);
// loop through unknown files
for (Map.Entry<String,String> unknownFileInfo : files.entrySet()) {
File inputFile = new File(unknownFileDir, unknownFileInfo.getKey());
if (inputFile.isDirectory()) {
continue;
}
ZipEntry newEntry = new ZipEntry(unknownFileInfo.getKey());
int method = Integer.parseInt(unknownFileInfo.getValue());
LOGGER.fine(String.format("Copying unknown file %s with method %d", unknownFileInfo.getKey(), method));
if (method == ZipEntry.STORED) {
newEntry.setMethod(ZipEntry.STORED);
newEntry.setSize(inputFile.length());
newEntry.setCompressedSize(-1);
BufferedInputStream unknownFile = new BufferedInputStream(new FileInputStream(inputFile));
CRC32 crc = BrutIO.calculateCrc(unknownFile);
newEntry.setCrc(crc.getValue());
} else {
newEntry.setMethod(ZipEntry.DEFLATED);
}
outputFile.putNextEntry(newEntry);
BrutIO.copy(inputFile, outputFile);
outputFile.closeEntry();
}
}
示例6: isModified
import brut.util.BrutIO; //导入依赖的package包/类
private boolean isModified(File[] working, File[] stored) {
for (int i = 0; i < stored.length; i++) {
if (!stored[i].exists()) {
return true;
}
}
return BrutIO.recursiveModifiedTime(working) > BrutIO.recursiveModifiedTime(stored);
}
示例7: copyToDir
import brut.util.BrutIO; //导入依赖的package包/类
public static void copyToDir(Directory in, Directory out, String fileName)
throws DirectoryException {
try {
if (in.containsDir(fileName)) {
// TODO: remove before copying
in.getDir(fileName).copyToDir(out.createDir(fileName));
} else {
BrutIO.copyAndClose(in.getFileInput(fileName),
out.getFileOutput(fileName));
}
} catch (IOException ex) {
throw new DirectoryException(
"Error copying file: " + fileName, ex);
}
}
示例8: isModified
import brut.util.BrutIO; //导入依赖的package包/类
private boolean isModified(File working, File stored) {
if (!stored.exists()) {
return true;
}
return BrutIO.recursiveModifiedTime(working) > BrutIO
.recursiveModifiedTime(stored);
}