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


Java TarArchiveOutputStream.setBigNumberMode方法代码示例

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


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

示例1: TarOutputService

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
@CreatesObligation
public TarOutputService(
        final FsModel model,
        final Sink sink,
        final TarDriver driver)
throws IOException {
    Objects.requireNonNull(model);
    this.driver = Objects.requireNonNull(driver);
    final OutputStream out = sink.stream();
    try {
        final TarArchiveOutputStream
                taos = this.taos = new TarArchiveOutputStream(out,
                    DEFAULT_BLKSIZE, DEFAULT_RCDSIZE, driver.getEncoding());
        taos.setAddPaxHeadersForNonAsciiNames(driver.getAddPaxHeaderForNonAsciiNames());
        taos.setLongFileMode(driver.getLongFileMode());
        taos.setBigNumberMode(driver.getBigNumberMode());
    } catch (final Throwable ex) {
        try {
            out.close();
        } catch (final Throwable ex2) {
            ex.addSuppressed(ex2);
        }
        throw ex;
    }
}
 
开发者ID:christian-schlichtherle,项目名称:truevfs,代码行数:26,代码来源:TarOutputService.java

示例2: compressFiles

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
public static void compressFiles(Collection<File> files, File output)
    throws IOException {
    // Create the output stream for the output file
    FileOutputStream fos = new FileOutputStream(output);
    // Wrap the output file stream in streams that will tar and gzip everything
    TarArchiveOutputStream taos = new TarArchiveOutputStream(
        new GZIPOutputStream(new BufferedOutputStream(fos)));
    // TAR has an 8 gig file limit by default, this gets around that
    taos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR); // to get past the 8 gig limit
    // TAR originally didn't support long file names, so enable the support for it
    taos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);

    // Get to putting all the files in the compressed output file
    for (File f : files) {
        addFilesToCompression(taos, f, ".");
    }

    // Close everything up
    taos.close();
    fos.close();
}
 
开发者ID:shopzilla,项目名称:hadoop-in-a-box,代码行数:22,代码来源:ClusterStateManager.java

示例3: createContainer

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
@Override
protected TarArchiveOutputStream createContainer(ServletOutputStream sout, String comment) {
    LOGGER.info("Constructing tar archive: {}", comment);
    TarArchiveOutputStream tout = new TarArchiveOutputStream(sout, "UTF8");
    tout.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
    tout.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
    return tout;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:9,代码来源:MCRTarServlet.java

示例4: marshal

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
@Override
public void marshal(final Exchange exchange, final Object graph, final OutputStream stream) throws Exception {
    String filename = exchange.getIn().getHeader(FILE_NAME, String.class);
    Long filelength = exchange.getIn().getHeader(FILE_LENGTH, Long.class);
    if (filename == null) {
        // generate the file name as the camel file component would do
        filename = StringHelper.sanitize(exchange.getIn().getMessageId());
    } else {
        filename = Paths.get(filename).getFileName().toString(); // remove any path elements
    }

    TarArchiveOutputStream tos = new TarArchiveOutputStream(stream);
    tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
    tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);

    InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, graph);
    if (filelength == null) {
        filelength = (long) is.available();
    }

    TarArchiveEntry entry = new TarArchiveEntry(filename);
    entry.setSize(filelength);
    tos.putArchiveEntry(entry);

    try {
        IOHelper.copy(is, tos);
    } finally {
        tos.closeArchiveEntry();
        IOHelper.close(is, tos);
    }

    String newFilename = filename + ".tar";
    exchange.getOut().setHeader(FILE_NAME, newFilename);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:35,代码来源:TarFileDataFormat.java

示例5: addFileToTar

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
private void addFileToTar(File source, File file, String fileName) throws IOException, ArchiveException {
    File tmpTar = File.createTempFile(source.getName(), null, parentDir);
    tmpTar.delete();
    if (!source.renameTo(tmpTar)) {
        throw new IOException("Could not make temp file (" + source.getName() + ")");
    }

    FileInputStream fis = new FileInputStream(tmpTar);
    TarArchiveInputStream tin = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.TAR, fis);
    TarArchiveOutputStream tos = new TarArchiveOutputStream(new FileOutputStream(source));
    tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
    tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);

    InputStream in = new FileInputStream(file);

    // copy the existing entries    
    ArchiveEntry nextEntry;
    while ((nextEntry = tin.getNextEntry()) != null) {
        tos.putArchiveEntry(nextEntry);
        IOUtils.copy(tin, tos);
        tos.closeArchiveEntry();
    }

    // Add the new entry
    TarArchiveEntry entry = new TarArchiveEntry(fileName == null ? file.getName() : fileName);
    entry.setSize(file.length());
    tos.putArchiveEntry(entry);
    IOUtils.copy(in, tos);
    tos.closeArchiveEntry();

    IOHelper.close(fis, in, tin, tos);
    LOG.trace("Deleting temporary file: {}", tmpTar);
    FileUtil.deleteFile(tmpTar);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:35,代码来源:TarAggregationStrategy.java

示例6: addEntryToTar

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
private void addEntryToTar(File source, String entryName, byte[] buffer, int length) throws IOException, ArchiveException {
    File tmpTar = File.createTempFile(source.getName(), null, parentDir);
    tmpTar.delete();
    if (!source.renameTo(tmpTar)) {
        throw new IOException("Cannot create temp file: " + source.getName());
    }

    FileInputStream fis = new FileInputStream(tmpTar);
    TarArchiveInputStream tin = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream(ArchiveStreamFactory.TAR, fis);
    TarArchiveOutputStream tos = new TarArchiveOutputStream(new FileOutputStream(source));
    tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
    tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);

    // copy the existing entries    
    ArchiveEntry nextEntry;
    while ((nextEntry = tin.getNextEntry()) != null) {
        tos.putArchiveEntry(nextEntry);
        IOUtils.copy(tin, tos);
        tos.closeArchiveEntry();
    }

    // Create new entry
    TarArchiveEntry entry = new TarArchiveEntry(entryName);
    entry.setSize(length);
    tos.putArchiveEntry(entry);
    tos.write(buffer, 0, length);
    tos.closeArchiveEntry();

    IOHelper.close(fis, tin, tos);
    LOG.trace("Deleting temporary file: {}", tmpTar);
    FileUtil.deleteFile(tmpTar);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:33,代码来源:TarAggregationStrategy.java

示例7: cacheLibrary

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
private void cacheLibrary (String language, String name)
		throws IOException, FTPIllegalReplyException, FTPException, FTPDataTransferException, FTPAbortedException,
		FTPListParseException
{
	File libdir = new File(cachedir, language + "/" + name);
	WorkerMain.getLogger().info("Caching Library " + name + " (" + language + ") to " + libdir.getAbsolutePath());
	libdir.mkdirs();
	DatastoreFtpClient.retrieveLibrary(name, language, libdir);
	File libtar = new File(cachedir, language + "/" + name + ".tar.bz2");
	TarArchiveOutputStream tar = new TarArchiveOutputStream(new BZip2CompressorOutputStream(new FileOutputStream(libtar)));
	tar.setBigNumberMode(BIGNUMBER_POSIX);
	tar.setLongFileMode(LONGFILE_POSIX);
	addToTar(libdir, tar, "");
	tar.close();
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:16,代码来源:LibraryCache.java

示例8: makeArchiveOutputStream

import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; //导入方法依赖的package包/类
@Override
public ArchiveOutputStream makeArchiveOutputStream(
        OutputStream stream) throws IOException, ArchiveException {
    TarArchiveOutputStream taos = new TarArchiveOutputStream(stream);
    taos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
    taos.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
    return taos;
}
 
开发者ID:turbolocust,项目名称:GZipper,代码行数:9,代码来源:Tarball.java


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