public void addFile ( final byte[] content, final String fileName, final EntryInformation entryInformation ) throws IOException { addFile ( new StaticContentProvider ( content ), fileName, entryInformation ); }
public void addFile ( final File file, final String fileName, final EntryInformation entryInformation ) throws IOException { addFile ( new FileContentProvider ( file ), fileName, entryInformation ); }
@Override public void addDirectory ( String directory, final EntryInformation entryInformation ) throws IOException { directory = cleanupPath ( directory ); if ( !directory.endsWith ( "/" ) ) { directory += '/'; } checkCreateParents ( directory ); internalAddDirectory ( directory, entryInformation ); }
private void addControlContent ( final TarArchiveOutputStream out, final String name, final ContentProvider content, final int mode ) throws IOException { if ( content == null || !content.hasContent () ) { return; } final TarArchiveEntry entry = new TarArchiveEntry ( name ); if ( mode >= 0 ) { entry.setMode ( mode ); } entry.setUserName ( "root" ); entry.setGroupName ( "root" ); entry.setSize ( content.getSize () ); entry.setModTime ( this.getTimestampProvider ().getModTime () ); out.putArchiveEntry ( entry ); try ( InputStream stream = content.createInputStream () ) { ByteStreams.copy ( stream, out ); } out.closeArchiveEntry (); }
private static void applyInfo ( final TarArchiveEntry entry, final EntryInformation entryInformation, TimestampProvider timestampProvider ) { if ( entryInformation == null ) { return; } if ( entryInformation.getUser () != null ) { entry.setUserName ( entryInformation.getUser () ); } if ( entryInformation.getGroup () != null ) { entry.setGroupName ( entryInformation.getGroup () ); } entry.setMode ( entryInformation.getMode () ); entry.setModTime ( timestampProvider.getModTime () ); }
protected ContentProvider createConfFilesContent () throws IOException { if ( this.confFiles.isEmpty () ) { return ContentProvider.NULL_CONTENT; } final StringWriter sw = new StringWriter (); for ( final String confFile : this.confFiles ) { sw.append ( confFile ).append ( '\n' ); } sw.close (); return new StaticContentProvider ( sw.toString () ); }
public void scoopFiles ( final DebianPackageWriter deb ) throws IOException { for ( final Map.Entry<String, File> entry : this.tempFiles.entrySet () ) { deb.addFile ( entry.getValue (), entry.getKey (), this.tempFilesOptions.get ( entry.getKey () ) ); } deleteTempFiles (); }
private static void validateFieldChar ( final char c, final String value ) { if ( c >= 33 && c <= 57 || c >= 59 && c <= 126 ) { return; } throw new InvalidValueException ( String.format ( "String must be US-ASCII based letters only: %s", value ) ); }
private void addControlContent ( final TarArchiveOutputStream out, final String name, final ContentProvider content, final int mode ) throws IOException { if ( content == null || !content.hasContent () ) { return; } final TarArchiveEntry entry = new TarArchiveEntry ( name ); if ( mode >= 0 ) { entry.setMode ( mode ); } entry.setUserName ( "root" ); entry.setGroupName ( "root" ); entry.setSize ( content.getSize () ); entry.setModTime ( this.getTimestampProvider ().getModTime () ); out.putArchiveEntry ( entry ); try ( InputStream stream = content.createInputStream () ) { ByteStreams.copy ( stream, out ); } out.closeArchiveEntry (); }
public void addFile ( final String content, final String fileName, final EntryInformation entryInformation ) throws IOException { addFile ( new StaticContentProvider ( content ), fileName, entryInformation ); }
public void addFile ( final File file, final String fileName, final EntryInformation entryInformation ) throws IOException { addFile ( new FileContentProvider ( file ), fileName, entryInformation ); }
private static void applyInfo ( final TarArchiveEntry entry, final EntryInformation entryInformation, TimestampProvider timestampProvider ) { if ( entryInformation == null ) { return; } if ( entryInformation.getUser () != null ) { entry.setUserName ( entryInformation.getUser () ); } if ( entryInformation.getGroup () != null ) { entry.setGroupName ( entryInformation.getGroup () ); } entry.setMode ( entryInformation.getMode () ); entry.setModTime ( timestampProvider.getModTime () ); }
@Override public void addDirectory ( String directory, final EntryInformation entryInformation ) throws IOException { directory = cleanupPath ( directory ); if ( !directory.endsWith ( "/" ) ) { directory += '/'; } checkCreateParents ( directory ); internalAddDirectory ( directory, entryInformation ); }
protected ContentProvider createConfFilesContent () throws IOException { if ( this.confFiles.isEmpty () ) { return ContentProvider.NULL_CONTENT; } final StringWriter sw = new StringWriter (); for ( final String confFile : this.confFiles ) { sw.append ( confFile ).append ( '\n' ); } sw.close (); return new StaticContentProvider ( sw.toString () ); }
public void scoopFiles ( final DebianPackageWriter deb ) throws IOException { for ( final Map.Entry<String, File> entry : this.tempFiles.entrySet () ) { deb.addFile ( entry.getValue (), entry.getKey (), this.tempFilesOptions.get ( entry.getKey () ) ); } deleteTempFiles (); }
private static void validateFieldChar ( final char c, final String value ) { if ( c >= 33 && c <= 57 || c >= 59 && c <= 126 ) { return; } throw new InvalidValueException ( String.format ( "String must be US-ASCII based letters only: %s", value ) ); }
public void addFile ( final byte[] content, final String fileName, final EntryInformation entryInformation ) throws IOException { addFile ( new StaticContentProvider ( content ), fileName, entryInformation ); }
protected static void validateNonEmpty ( final String label, final String value ) throws InvalidValueException { if ( value == null ) { throw new InvalidValueException ( String.format ( "'%s' must not be null" ) ); } if ( value.isEmpty () ) { throw new InvalidValueException ( String.format ( "'%s' must not be empty" ) ); } }
public void addFile ( final String content, final String fileName, final EntryInformation entryInformation ) throws IOException { addFile ( new StaticContentProvider ( content ), fileName, entryInformation ); }
protected static void validateNonEmpty ( final String label, final String value ) throws InvalidValueException { if ( value == null ) { throw new InvalidValueException ( String.format ( "'%s' must not be null" ) ); } if ( value.isEmpty () ) { throw new InvalidValueException ( String.format ( "'%s' must not be empty" ) ); } }