@Override public InputStream create(String entry) throws IOException { return new TFileInputStream(entry); } });
protected ScreenshotMeta loadMeta(final TFile file) throws IOException { ScreenshotMeta meta; TFileInputStream in = new TFileInputStream(file); try { meta = ScreenshotMeta.load(in); } finally { in.close(); } return meta; }
/** * Constructs a new input stream for reading plain old files or entries * in an archive file. * * @param file the plain old file or entry in an archive file to read. * @throws FileNotFoundException on any I/O failure. */ @CreatesObligation @edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION") public TFileInputStream(File file) throws FileNotFoundException { super(newInputStream(file)); }
public static ClassFile readFile(TFile file) { try { TFileInputStream tFileInputStream = new TFileInputStream(file); return readFromInputStream(tFileInputStream); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Could not find file: " + file, e); } catch (IOException e) { throw new IllegalStateException("Could not read file: " + file, e); } }
try is = new TFileInputStream(location); is.close(); // ALWAYS close the stream!
/** * Constructs a new input stream for reading plain old files or entries * in an archive file. * This constructor calls {@link TFile#TFile(String) new TFile(path)} for * the given path. * * @param path the path of the plain old file or entry in an archive file * to read. * @throws FileNotFoundException on any I/O failure. */ @CreatesObligation @edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION") public TFileInputStream(String path) throws FileNotFoundException { super(newInputStream(new TFile(path))); }
@Override public void importProjects(File file) throws FileNotFoundException, IOException { Map<String, Map<String, GenericEntity<Long, ?>>> idsMapping = new HashMap<String, Map<String, GenericEntity<Long, ?>>>(); Workbook workbook = new HSSFWorkbook(new TFileInputStream(file)); doImportItem(idsMapping, workbook, Project.class); doImportItem(idsMapping, workbook, ProjectVersion.class); }
try is = new TFileInputStream(location); is.close(); // ALWAYS close the stream!
/** * Constructs a new {@code TFile} reader. * <p> * TODO: Remove this redundant constructor in TrueZIP 8. * * @param file a file to read. * @param decoder a decoder for decoding bytes to characters. * @throws FileNotFoundException on any I/O failure. */ @CreatesObligation @edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION") public TFileReader(TFile file, CharsetDecoder decoder) throws FileNotFoundException { super(new TFileInputStream(file), decoder); }
throw new NullPointerException(); final @WillClose TFileInputStream in = new TFileInputStream(this); try { Streams.cat(in, out); } finally { in.close();
/** * Constructs a new {@code TFile} reader. * * @param file a file to read. * @param decoder a decoder for decoding bytes to characters. * @throws FileNotFoundException on any I/O failure. */ @CreatesObligation @edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION") public TFileReader(File file, CharsetDecoder decoder) throws FileNotFoundException { super(new TFileInputStream(file), decoder); }
assert dir.isDirectory(); try { new TFileInputStream(dir).close(); if ('\\' == separatorChar) fail();
/** * Constructs a new {@code TFile} reader. * * @param file a file to read. * @param charset a character set for decoding bytes to characters. * @throws FileNotFoundException on any I/O failure. * @since TrueZIP 7.5 */ @CreatesObligation @edu.umd.cs.findbugs.annotations.SuppressWarnings("OBL_UNSATISFIED_OBLIGATION") public TFileReader(File file, Charset charset) throws FileNotFoundException { super(new TFileInputStream(file), charset); }
final InputStream in1 = new TFileInputStream(file1); new TFileInputStream(file2).close(); fail(); } catch (final FileNotFoundException ex) { new TFileInputStream(file1);
/** * Constructs a new {@code TFile} reader. * This reader uses the default character set for decoding bytes to * characters. * * @param file a file to read. * @throws FileNotFoundException on any I/O failure. */ @CreatesObligation @edu.umd.cs.findbugs.annotations.SuppressWarnings({ "DM_DEFAULT_ENCODING", "OBL_UNSATISFIED_OBLIGATION" }) public TFileReader(File file) throws FileNotFoundException { super(new TFileInputStream(file)); }
InputStream in = new TFileInputStream(file); try { byte[] buf = new byte[getDataLength()]; new TFileInputStream(archive).close(); if ('\\' == separatorChar) fail(); new TFileInputStream(archive).close(); if ('\\' == separatorChar) fail();
/** * Constructs a new {@code TFile} reader. * This reader uses the default character set for decoding bytes to * characters. * <p> * TODO: Remove this redundant constructor in TrueZIP 8. * * @param file a file to read. * @throws FileNotFoundException on any I/O failure. */ @CreatesObligation @edu.umd.cs.findbugs.annotations.SuppressWarnings({ "DM_DEFAULT_ENCODING", "OBL_UNSATISFIED_OBLIGATION" }) public TFileReader(TFile file) throws FileNotFoundException { super(new TFileInputStream(file)); }
private void cat(final String[] args) throws IllegalUsageException, IOException { if (args.length < 1) throw new IllegalUsageException(); for (int i = 0; i < args.length; i++) { final InputStream in = new TFileInputStream(args[i]); try { TFile.cat(in, out); } finally { in.close(); } } }
/** * Finds a single attribute from a war manifest file. * @param war the war * @return Manifest * @throws ModuleManagementToolException */ @Override public Manifest findManifest(TFile war) throws ModuleManagementToolException { InputStream is = null; try { is = new TFileInputStream(war+MANIFEST_FILE); Manifest manifest = new Manifest(is); return manifest; } catch (IOException e) { throw new ModuleManagementToolException("Unabled to read a manifest for the war file: "+ war); } finally { if (is != null) { try { is.close(); } catch (Throwable e ) {} } } }
@SuppressFBWarnings("OS_OPEN_STREAM") final byte[] read(final Node node) throws IOException { final File file = node.file(); final byte[] code; { final long l = file.length(); final int mb = ctx.maxBytes(); if (l > mb) throw new IOException( String.format("%s (%,d bytes exceeds max %,d bytes)", file, l, mb)); code = new byte[(int) l]; } { final InputStream in = new TFileInputStream(file); try { new DataInputStream(in).readFully(code); } finally { in.close(); } } return code; }