@Override public InputStream getInputStream() throws FileNotFoundException { return delegate.getInputStream(); }
/** Get input stream. * @return an input stream to read the contents of this file * @exception FileNotFoundException if the file does not exists, is a folder * rather than a regular file or is invalid */ public InputStream getInputStream() throws java.io.FileNotFoundException { return leader.getInputStream(); }
private void initReader() throws UnsupportedEncodingException, IOException { InputStream is; if (lines.fo.getSize() < 64 * 1024) { if (buffer == null) { buffer = lines.fo.asBytes(); } is = new ByteArrayInputStream(buffer); } else { is = lines.fo.getInputStream(); } this.reader = new BufferedReader(new InputStreamReader(is, encoding)); this.index = 0; while (this.index < index) { next(); } }
boolean matched = false; try { is = fo.getInputStream(); // it is CachedInputStream, so you can call getInputStream and read more times without performance penalty byte[] byteRange = new byte[range]; int read = is.read(byteRange);
public InputStream getInputStream() throws java.io.FileNotFoundException { if (fixIt == null) { if (ERR.isLoggable(Level.FINE)) { LogRecord rec = new LogRecord(Level.FINE, "MSG_CACHED_INPUT_STREAM"); rec.setParameters(new Object[] { this }); rec.setResourceBundle(NbBundle.getBundle(MIMESupport.class)); ERR.log(rec); } InputStream is = fileObj.getInputStream(); fixIt = new CachedInputStream(is); } fixIt.cacheToStart(); return fixIt; }
/** Reads the full content of the file object and returns it as array of * bytes. * @return array of bytes * @exception IOException in case the content cannot be fully read * @since 7.21 */ public byte[] asBytes() throws IOException { long len = getSize(); if (len > Integer.MAX_VALUE) { throw new IOException("Too big file " + getPath()); // NOI18N } InputStream is = getInputStream(); try { byte[] arr = new byte[(int)len]; int pos = 0; while (pos < arr.length) { int read = is.read(arr, pos, arr.length - pos); if (read == -1) { break; } pos += read; } if (pos != arr.length) { throw new IOException("Just " + pos + " bytes read from " + getPath()); // NOI18N } return arr; } finally { is.close(); } }
public InputStream getInputStream() throws IOException, UnknownServiceException { connect(); if (iStream == null) { try { if (fo.isFolder()) { iStream = new FIS(fo); } else { iStream = fo.getInputStream(); } } catch (FileNotFoundException e) { ExternalUtil.exception(e); throw e; } } return iStream; }
is = fo.getInputStream(); in.setByteStream(is); in.setSystemId(fo.toURL().toExternalForm());
InputStream in = fo.getInputStream();
in = fo.getInputStream(); int read = in.read(header); if (read < 0) {
bufIn = source.getInputStream();
/** Get input stream. * @return an input stream to read the contents of this file * @exception FileNotFoundException if the file does not exists, is a folder * rather than a regular file or is invalid */ public InputStream getInputStream () throws java.io.FileNotFoundException { return leader.getInputStream (); }
/** Get input stream. * @return an input stream to read the contents of this file * @exception FileNotFoundException if the file does not exists, is a folder * rather than a regular file or is invalid */ public InputStream getInputStream () throws java.io.FileNotFoundException { return leader.getInputStream (); }
public InputStream getInputStream() throws FileNotFoundException { try { InputStream in = m_delegate.getInputStream(); return new GZIPInputStream(in); } catch (IOException ex) { Exceptions.printStackTrace(ex); return null; } }
@Override public Stock load(FileObject fileObject) { Stock stockProject = null; try (ObjectInputStream ois = new ObjectInputStream(fileObject.getInputStream())) { stockProject = (Stock) ois.readObject(); } catch (ClassNotFoundException | IOException ex) { Exceptions.printStackTrace(ex); } return stockProject; }
public JsObject loadGlobalObject(FileObject fileObject, int length, String sourceLabel, URL defaultDocURL) throws IOException { InputStream is = fileObject.getInputStream(); try { return loadGlobalObject(is, sourceLabel, defaultDocURL); } finally { is.close(); } }
public Reader getReader(Object object, String encoding) throws IOException { Wrap w = (Wrap)object; if (w.reader == null) { Charset chset = FileEncodingQuery.getEncoding(w.fo); w.reader = new InputStreamReader(w.fo.getInputStream(), chset); } return w.reader; }
protected InputStream getInputStream(Transferable transferable) { try { FileObject fileNode = getNodeFileObject(transferable); return fileNode != null ? fileNode.getInputStream() : null; } catch (FileNotFoundException ex) { Debug.warning(ex); } return null; }
public Object run() throws Exception { EditableProperties ep = new EditableProperties(); FileObject propFile = project.getProjectDirectory().getFileObject(AntProjectHelper.PROJECT_PROPERTIES_PATH); InputStream is = propFile.getInputStream(); ep.load(is); is.close(); return ep; } });
private void copyContent(File file, TmpLocalFile localTmpFile) throws IOException { FileObject fileObject = FileUtil.toFileObject(file); if (fileObject == null || !fileObject.isValid()) { return; } try (InputStream inputStream = fileObject.getInputStream(); OutputStream outputStream = localTmpFile.getOutputStream()) { FileUtil.copy(inputStream, outputStream); } }