本文整理汇总了Java中org.apache.commons.io.FileUtils.checksumCRC32方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.checksumCRC32方法的具体用法?Java FileUtils.checksumCRC32怎么用?Java FileUtils.checksumCRC32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.io.FileUtils
的用法示例。
在下文中一共展示了FileUtils.checksumCRC32方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ModuleClassLoader
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
private ModuleClassLoader(final File moduleJarFile,
final File tempModuleJarFile,
final ClassLoader sandboxClassLoader) throws IOException {
super(
new URL[]{new URL("file:" + tempModuleJarFile.getPath())},
new Routing(
sandboxClassLoader,
"^com\\.alibaba\\.jvm\\.sandbox\\.api\\..*",
"^javax\\.servlet\\..*",
"^javax\\.annotation\\.Resource.*$"
)
);
this.checksumCRC32 = FileUtils.checksumCRC32(moduleJarFile);
this.moduleJarFile = moduleJarFile;
this.tempModuleJarFile = tempModuleJarFile;
try {
cleanProtectionDomainWhichCameFromModuleClassLoader();
logger.debug("clean ProtectionDomain in {}'s acc success.", this);
} catch (Throwable e) {
logger.warn("clean ProtectionDomain in {}'s acc failed.", this, e);
}
}
示例2: testCheckpointOnClose
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
@Test
public void testCheckpointOnClose() throws Exception {
log.close();
log = new Log.Builder().setCheckpointInterval(1L)
.setMaxFileSize(MAX_FILE_SIZE)
.setQueueSize(CAPACITY)
.setCheckpointDir(checkpointDir)
.setLogDirs(dataDirs)
.setCheckpointOnClose(true)
.setChannelName("testLog")
.build();
log.replay();
// 1 Write One Event
FlumeEvent eventIn = TestUtils.newPersistableEvent();
log.put(transactionID, eventIn);
log.commitPut(transactionID);
// 2 Check state of checkpoint before close
File checkPointMetaFile =
FileUtils.listFiles(checkpointDir, new String[] { "meta" }, false).iterator().next();
long before = FileUtils.checksumCRC32(checkPointMetaFile);
// 3 Close Log
log.close();
// 4 Verify that checkpoint was modified on close
long after = FileUtils.checksumCRC32(checkPointMetaFile);
Assert.assertFalse(before == after);
}
示例3: getChecksum
import org.apache.commons.io.FileUtils; //导入方法依赖的package包/类
public long getChecksum(File file) throws IOException
{
return FileUtils.checksumCRC32(file);
}