本文整理汇总了Java中org.apache.hadoop.fs.slive.DataVerifier.VerifyOutput类的典型用法代码示例。如果您正苦于以下问题:Java VerifyOutput类的具体用法?Java VerifyOutput怎么用?Java VerifyOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VerifyOutput类属于org.apache.hadoop.fs.slive.DataVerifier包,在下文中一共展示了VerifyOutput类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDataWriting
import org.apache.hadoop.fs.slive.DataVerifier.VerifyOutput; //导入依赖的package包/类
@Test
public void testDataWriting() throws Exception {
long byteAm = 100;
File fn = getTestFile();
DataWriter writer = new DataWriter(rnd);
FileOutputStream fs = new FileOutputStream(fn);
GenerateOutput ostat = writer.writeSegment(byteAm, fs);
LOG.info(ostat);
fs.close();
assertTrue(ostat.getBytesWritten() == byteAm);
DataVerifier vf = new DataVerifier();
FileInputStream fin = new FileInputStream(fn);
VerifyOutput vfout = vf.verifyFile(byteAm, new DataInputStream(fin));
LOG.info(vfout);
fin.close();
assertEquals(vfout.getBytesRead(), byteAm);
assertTrue(vfout.getChunksDifferent() == 0);
}
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestSlive.java
示例2: testBadChunks
import org.apache.hadoop.fs.slive.DataVerifier.VerifyOutput; //导入依赖的package包/类
@Test
public void testBadChunks() throws Exception {
File fn = getTestFile();
int byteAm = 10000;
FileOutputStream fout = new FileOutputStream(fn);
byte[] bytes = new byte[byteAm];
rnd.nextBytes(bytes);
fout.write(bytes);
fout.close();
// attempt to read it
DataVerifier vf = new DataVerifier();
VerifyOutput vout = new VerifyOutput(0, 0, 0, 0);
DataInputStream in = null;
try {
in = new DataInputStream(new FileInputStream(fn));
vout = vf.verifyFile(byteAm, in);
} catch (Exception e) {
} finally {
if(in != null) in.close();
}
assertTrue(vout.getChunksSame() == 0);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestSlive.java
注:本文中的org.apache.hadoop.fs.slive.DataVerifier.VerifyOutput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论