本文整理匯總了Java中org.tukaani.xz.SeekableXZInputStream類的典型用法代碼示例。如果您正苦於以下問題:Java SeekableXZInputStream類的具體用法?Java SeekableXZInputStream怎麽用?Java SeekableXZInputStream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SeekableXZInputStream類屬於org.tukaani.xz包,在下文中一共展示了SeekableXZInputStream類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findLastTarEntry
import org.tukaani.xz.SeekableXZInputStream; //導入依賴的package包/類
private InputStream findLastTarEntry() throws IOException {
SeekableXZInputStream stream = (SeekableXZInputStream)xz.stream();
stream.seekToBlock(stream.getBlockCount() - 2);
byte[] buffer = new byte[(int)(stream.length() - stream.position())];
IOUtils.readFully(stream, buffer);
ByteArrayInputStream memoryStream = new ByteArrayInputStream(buffer);
TarArchiveInputStream tar = new TarArchiveInputStream(memoryStream);
for (int i = 0; i < (buffer.length / TarConstants.DEFAULT_RCDSIZE); i++) {
TarArchiveEntry entry = null;
memoryStream.reset();
memoryStream.skip(i * TarConstants.DEFAULT_RCDSIZE);
tar.reset();
try {
entry = tar.getNextTarEntry();
} catch (IOException ex) {
}
if (entry != null && entry.getName().equals(FOOTER_NAME)) {
return tar;
}
}
throw new IOException("Invalid file format");
}
示例2: getXZScanner
import org.tukaani.xz.SeekableXZInputStream; //導入依賴的package包/類
private static Scanner getXZScanner(String filePath){
try{
return testScanner(new Scanner(new SeekableXZInputStream(new SeekableFileInputStream(new File(filePath)))));
}catch(Throwable e){
return null;
}
}
示例3: XZBlockCache
import org.tukaani.xz.SeekableXZInputStream; //導入依賴的package包/類
public XZBlockCache(String archivePath) throws IOException {
is = new SeekableXZInputStream(new SeekableFileInputStream(archivePath));
log.debug(is);
}