private static void hasField ( final GenericControlFile controlFile, final ControlFieldDefinition definition ) { final ControlField result = controlFile.get ( definition ); if ( result == null ) { throw new IllegalStateException ( String.format ( "Control file must have field '%s'", definition.getName () ) ); } }
protected ContentProvider createControlContent () throws IOException { this.packageControlFile.set ( BinaryPackageControlFile.Fields.INSTALLED_SIZE, "" + this.installedSize ); final StringWriter sw = new StringWriter (); try ( ControlFileWriter writer = new ControlFileWriter ( sw ) ) { this.packageControlFile.write ( writer ); } sw.close (); return new StaticContentProvider ( sw.toString () ); }
protected ContentProvider createControlContent () throws IOException { this.packageControlFile.set ( BinaryPackageControlFile.Fields.INSTALLED_SIZE, "" + this.installedSize ); final StringWriter sw = new StringWriter (); try ( ControlFileWriter writer = new ControlFileWriter ( sw ) ) { this.packageControlFile.write ( writer ); } sw.close (); return new StaticContentProvider ( sw.toString () ); }
private static void hasField ( final GenericControlFile controlFile, final ControlFieldDefinition definition ) { final ControlField result = controlFile.get ( definition ); if ( result == null ) { throw new IllegalStateException ( String.format ( "Control file must have field '%s'", definition.getName () ) ); } }