当前位置: 首页>>代码示例>>Java>>正文


Java XZ.CHECK_CRC32属性代码示例

本文整理汇总了Java中org.tukaani.xz.XZ.CHECK_CRC32属性的典型用法代码示例。如果您正苦于以下问题:Java XZ.CHECK_CRC32属性的具体用法?Java XZ.CHECK_CRC32怎么用?Java XZ.CHECK_CRC32使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.tukaani.xz.XZ的用法示例。


在下文中一共展示了XZ.CHECK_CRC32属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInstance

public static Check getInstance(int checkType)
        throws UnsupportedOptionsException {
    switch (checkType) {
        case XZ.CHECK_NONE:
            return new None();

        case XZ.CHECK_CRC32:
            return new CRC32();

        case XZ.CHECK_CRC64:
            return new CRC64();

        case XZ.CHECK_SHA256:
            try {
                return new SHA256();
            } catch (java.security.NoSuchAlgorithmException e) {}

            break;
    }

    throw new UnsupportedOptionsException(
            "Unsupported Check ID " + checkType);
}
 
开发者ID:dbrant,项目名称:zimdroid,代码行数:23,代码来源:Check.java

示例2: getInstance

public static Check getInstance(int checkType)
		throws UnsupportedOptionsException {
	switch (checkType) {
	case XZ.CHECK_NONE:
		return new None();

	case XZ.CHECK_CRC32:
		return new CRC32();

	case XZ.CHECK_CRC64:
		return new CRC64();

	case XZ.CHECK_SHA256:
		try {
			return new SHA256();
		} catch (java.security.NoSuchAlgorithmException e) {
		}

		break;
	}

	throw new UnsupportedOptionsException("Unsupported Check ID "
			+ checkType);
}
 
开发者ID:anadon,项目名称:JLS,代码行数:24,代码来源:Check.java

示例3: XzStep

/**
 * Creates an XzStep to compress a file with XZ compression level 4.
 *
 * <p> The destination file will be {@code sourceFile} with the added {@code .xz} extension.
 * <p> Decompression will require 5MiB of RAM.
 *
 * @param sourceFile file to compress
 */
public XzStep(Path sourceFile) {
  this(
      sourceFile,
      Paths.get(sourceFile + ".xz"),
      /* compressionLevel */ 4,
      /* keep */ false,
      XZ.CHECK_CRC32);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:16,代码来源:XzStep.java

示例4: testXzStep

@Test
public void testXzStep() throws InterruptedException, IOException {
  final Path sourceFile =
      TestDataHelper.getTestDataScenario(this, "xz_with_rm_and_check").resolve("xzstep.data");
  final File destinationFile = tmp.newFile("xzstep.data.xz");

  XzStep step =
      new XzStep(
          TestProjectFilesystems.createProjectFilesystem(tmp.getRoot().toPath()),
          sourceFile,
          destinationFile.toPath(),
          /* compressionLevel -- for faster testing */ 1,
          /* keep */ true,
          XZ.CHECK_CRC32);

  ExecutionContext context = TestExecutionContext.newInstance();

  assertEquals(0, step.execute(context).getExitCode());

  ByteSource original = PathByteSource.asByteSource(sourceFile);
  ByteSource decompressed =
      new ByteSource() {
        @Override
        public InputStream openStream() throws IOException {
          return new XZInputStream(new FileInputStream(destinationFile));
        }
      };

  assertTrue(
      "Decompressed file must be identical to original.", original.contentEquals(decompressed));
}
 
开发者ID:facebook,项目名称:buck,代码行数:31,代码来源:XzStepTest.java

示例5: testXzStep

@Test
public void testXzStep() throws IOException {
  final File sourceFile = new File(
      TestDataHelper.getTestDataScenario(this, "xz_with_rm_and_check"),
      "xzstep.data");
  final File destinationFile = tmp.newFile("xzstep.data.xz");

  XzStep step = new XzStep(
      sourceFile.toPath(),
      destinationFile.toPath(),
      /* compressionLevel -- for faster testing */ 1,
      /* keep */ false,
      XZ.CHECK_CRC32);

  ProjectFilesystem fs = EasyMock.createMock(ProjectFilesystem.class);
  EasyMock.expect(fs.deleteFileAtPath(sourceFile.toPath())).andReturn(true);
  EasyMock.replay(fs);

  ExecutionContext context = TestExecutionContext.newBuilder()
      .setProjectFilesystem(fs)
      .build();

  assertEquals(0, step.execute(context));

  ByteSource original = Files.asByteSource(sourceFile);
  ByteSource decompressed = new ByteSource() {
    @Override
    public InputStream openStream() throws IOException {
      return new XZInputStream(new FileInputStream(destinationFile));
    }
  };

  assertTrue(
      "Decompressed file must be identical to original.",
      original.contentEquals(decompressed));

  EasyMock.verify(fs);
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:38,代码来源:XzStepTest.java

示例6: XzStep

/**
 * Creates an XzStep to compress a file with XZ at a user supplied compression level .
 *
 * <p>The destination file will be {@code sourceFile} with the added {@code .xz} extension.
 *
 * <p>Decompression will require up to 64MiB of RAM.
 *
 * @param sourceFile file to compress
 * @param compressionLevel value from 0 to 9. Higher values result in better compression, but also
 *     need more time to compress and will need more RAM to decompress.
 */
public XzStep(ProjectFilesystem filesystem, Path sourceFile, int compressionLevel) {
  this(
      filesystem,
      sourceFile,
      Paths.get(sourceFile + ".xz"),
      compressionLevel,
      /* keep */ false,
      XZ.CHECK_CRC32);
}
 
开发者ID:facebook,项目名称:buck,代码行数:20,代码来源:XzStep.java


注:本文中的org.tukaani.xz.XZ.CHECK_CRC32属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。