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

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

Introduction

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

Prototype

int C_ISLNK

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

Click Source Link

Document

Defines a symbolic link

Usage

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

private void addSymbolicLink(final String targetName, final String linkTo, 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_ISLNK);

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

    Consumer<FileEntry> c = this::initEntry;
    c = c.andThen(entry -> {/*from  w w w .  j a va2  s  . c  o m*/
        entry.setModificationTime((int) mtime);
        entry.setInode(inode);
        entry.setMode(smode);
        entry.setSize(result.getSize());
        entry.setTargetSize(result.getSize());
        entry.setLinkTo(linkTo);
    });

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

    addResult(pathName, result, c);
}