private Object convert(Type type, File in, TaggedData tag) throws IOException, Exception { if (type == TaggedData.class) return tag; if (type == File.class) return in; try (InputStream fin = IO.stream(in)) { return convert(type, fin); } }
@Override public void add(Archive archive, File in) throws Exception { try (InputStream fin = IO.stream(in)) { add(archive, fin); } catch (Exception e) { aborted = true; throw e; } }
public static RevisionMetadata parseRevisionMetadata(File metadataFile) throws Exception { try (InputStream in = IO.stream(metadataFile)) { return parseRevisionMetadata(in); } }
public static ProgramMetadata parseProgramMetadata(File metafile) throws Exception { try (InputStream in = IO.stream(metafile)) { return parseProgramMetadata(in); } catch (Exception e) { System.out.println("File " + metafile + " failed"); throw e; } }
private Object convert(Type type, File in, TaggedData tag) throws IOException, Exception { if (type == TaggedData.class) return tag; if (type == File.class) return in; try (InputStream fin = IO.stream(in)) { return convert(type, fin); } }
public static RevisionMetadata parseRevisionMetadata(File metadataFile) throws Exception { try (InputStream in = IO.stream(metadataFile)) { return parseRevisionMetadata(in); } }
public static ProgramMetadata parseProgramMetadata(File metafile) throws Exception { try (InputStream in = IO.stream(metafile)) { return parseProgramMetadata(in); } catch (Exception e) { System.out.println("File " + metafile + " failed"); throw e; } }
@Override public void add(Archive archive, File in) throws Exception { try (InputStream fin = IO.stream(in)) { add(archive, fin); } catch (Exception e) { aborted = true; throw e; } }
@Override public InputStream openInputStream() throws Exception { return IO.stream(buffer()); }
@Override public InputStream openInputStream() throws Exception { return IO.stream(buffer()); }
@Override public InputStream openInputStream() { return IO.stream(buffer()); }
@Override public InputStream openInputStream() throws Exception { return IO.stream(buffer()); }
public void setManifest(File file) throws IOException { check(); try (InputStream fin = IO.stream(file)) { Manifest m = new Manifest(fin); setManifest(m); } }
public void setManifest(File file) throws IOException { check(); try (InputStream fin = IO.stream(file)) { Manifest m = new Manifest(fin); setManifest(m); } }
@Override public void encode(Encoder app, Object object, Map<Object, Type> visited) throws IOException, Exception { File f = (File) object; if (!f.isFile()) throw new RuntimeException("Encoding a file requires the file to exist and to be a normal file " + f); try (InputStream in = IO.stream(f)) { app.append('"'); Base64.encode(in, app); app.append('"'); } }
@Override public void encode(Encoder app, Object object, Map<Object, Type> visited) throws IOException, Exception { File f = (File) object; if (!f.isFile()) throw new RuntimeException("Encoding a file requires the file to exist and to be a normal file " + f); try (InputStream in = IO.stream(f)) { app.append('"'); Base64.encode(in, app); app.append('"'); } }
@Override public void encode(Encoder app, Object object, Map<Object, Type> visited) throws IOException, Exception { File f = (File) object; if (!f.isFile()) throw new RuntimeException("Encoding a file requires the file to exist and to be a normal file " + f); try (InputStream in = IO.stream(f)) { app.append('"'); Base64.encode(in, app); app.append('"'); } }
private void install(File f, RepositoryPlugin repo, Attrs value) throws Exception { try (Processor p = new Processor()) { p.getProperties() .putAll(value); PutOptions options = new PutOptions(); options.context = p; try (InputStream in = IO.stream(f)) { repo.put(in, options); } catch (Exception e) { exception(e, "Cannot install %s into %s because %s", f, repo.getName(), e); } } }