Example usage for org.apache.commons.compress.archivers.cpio CpioConstants C_ISDIR

List of usage examples for org.apache.commons.compress.archivers.cpio CpioConstants C_ISDIR

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers.cpio CpioConstants C_ISDIR.

Prototype

int C_ISDIR

To view the source code for org.apache.commons.compress.archivers.cpio CpioConstants C_ISDIR.

Click Source Link

Document

Defines a directory

Usage

From source file:org.eclipse.packagedrone.utils.rpm.build.RpmBuilder.java

private void addDirectory(final String targetName, final int mode, final Instant modInstant,
        final Consumer<FileEntry> customizer) throws IOException {
    final PathName pathName = PathName.parse(targetName);

    final long mtime = modInstant.getEpochSecond();
    final int inode = this.currentInode++;

    final short smode = (short) (mode | CpioConstants.C_ISDIR);

    final Result result = this.recorder.addDirectory("./" + pathName.toString(),
            cpioCustomizer(mtime, inode, smode));

    Consumer<FileEntry> c = this::initEntry;
    c = c.andThen(entry -> {/*from  w  w w .ja v a  2  s. c  o m*/
        entry.setModificationTime((int) mtime);
        entry.setInode(inode);
        entry.setMode(smode);
        entry.setSize(0);
        entry.setTargetSize(4096);
    });

    if (customizer != null) {
        c = c.andThen(customizer);
    }

    addResult(pathName, result, c);
}