Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2015, 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.packager.rpm.build;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public interface BuilderContext
{
public static final String DEFAULT_USER = "root";
public static final String DEFAULT_GROUP = "root";
public static final class Directory
{
private Directory ()
{
}
}
public static final class SymbolicLink
{
private SymbolicLink ()
{
}
}
public static final Directory DIRECTORY = new Directory ();
public static final SymbolicLink SYMBOLIC_LINK = new SymbolicLink ();
public static FileInformationCustomizer pathCustomizer ()
{
return new FileInformationCustomizer () {
@Override
public void perform ( final Path path, final FileInformation information ) throws IOException
{
information.setTimestamp ( Files.getLastModifiedTime ( path ).toInstant () );
}
};
}
public static SimpleFileInformationCustomizer nowTimestampCustomizer ()
{
return Defaults.NOW_TIMESTAMP_CUSTOMIZER;
}
public static SimpleFileInformationCustomizer modeCustomizer ( final short mode )
{
return new SimpleFileInformationCustomizer () {
@Override
public void perform ( final FileInformation information )
{
information.setMode ( mode );
}
};
}
public static FileInformationProvider pathProvider ()
{
return Defaults.PATH_PROVIDER;
}
public static FileInformationProvider simpleProvider ( final int mode )
{
return new FileInformationProvider () {
@Override
public FileInformation provide ( final String targetName, final T object, final PayloadEntryType type ) throws IOException
{
return new FileInformation ();
}
}.customize ( nowTimestampCustomizer () ).customize ( modeCustomizer ( (short)mode ) );
}
@SuppressWarnings ( "unchecked" )
public static FileInformationProvider simpleFileProvider ()
{
return (FileInformationProvider)Defaults.SIMPLE_FILE_PROVIDER;
}
@SuppressWarnings ( "unchecked" )
public static FileInformationProvider simpleDirectoryProvider ()
{
return (FileInformationProvider)Defaults.SIMPLE_DIRECTORY_PROVIDER;
}
public static FileInformationProvider multiProvider ( final FileInformationProvider