@Override public InputStream newInputStream(Path path, OpenOption... options) throws IOException { initStorage(); InputStream result = super.newInputStream(path, options); CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path); int blockSize = cloudPath.getFileSystem().config().blockSize(); for (OpenOption option : options) { if (option instanceof OptionBlockSize) { blockSize = ((OptionBlockSize) option).size(); } } return new BufferedInputStream(result, blockSize); }
@Override public InputStream newInputStream(final Path path, final OpenOption... options) throws IOException { return delegate.newInputStream(path, options); }
public void beginFileRead(String absolutePath) { Path path = fileSystem.getPath(absolutePath); try { inputStream = fileSystem.provider().newInputStream(path, StandardOpenOption.READ); } catch (IOException e) { logger.warn("File error ",e); inputStream = null; } }
@Override public InputStream newInputStream(Path path, OpenOption... options) throws IOException { // Avoid copying out to a file, like newByteChannel / newFileChannel BundleFileSystem fs = (BundleFileSystem) path.getFileSystem(); return origProvider(path).newInputStream(fs.unwrap(path), options); }
@Override public InputStream newInputStream(Path path, OpenOption... options) throws IOException { Path r = unroot(path); FileSystemProvider p = provider(r); return p.newInputStream(r, options); }
@Override public InputStream newInputStream(Path path, OpenOption... options) throws IOException { Path r = unroot(path); FileSystemProvider p = provider(r); return p.newInputStream(r, options); }
@Override public InputStream newInputStream(Path path, OpenOption... options) throws IOException { Path r = unroot(path); FileSystemProvider p = provider(r); return p.newInputStream(r, options); }
@Override public InputStream newInputStream(final Path path, final OpenOption... options) throws IOException {return wrapped().newInputStream(unwrap(path), options);}
public static InputStream getInputStream(URI uri) throws IOException, URISyntaxException { FileSystem fs = getFileSystem(uri); Path path = getPath(uri); return fs.provider().newInputStream(path); }
for (Path path : pathes) { if (getFileName(path).equals(FILE_META_DATA)) { try (InputStream inputStream = path.getFileSystem().provider().newInputStream(path)) { summaries.setMetaData(metaDataReader.read(new InputStreamReader(inputStream))); } catch (Exception e) {
private static boolean loadTextureFromAssets(ResourceLocation loc, String path) { //noinspection ConstantConditions String fullPath = "assets/" + AncientWarfareCore.MOD_ID + "/" + path; File source = Loader.instance().activeModContainer().getSource(); if (source.isFile()) { try (FileSystem fs = FileSystems.newFileSystem(source.toPath(), null)) { InputStream inputstream = fs.provider().newInputStream(fs.getPath(fullPath)); Minecraft.getMinecraft().renderEngine.loadTexture(loc, new TextureImageBased(loc, ImageIO.read(inputstream))); return true; } catch (IOException e) { //noop } } else if (source.isDirectory()) { File file = source.toPath().resolve(fullPath).toFile(); if (loadTexture(loc, file)) { return true; } } return false; } }
FileSystem fs = path.getFileSystem(); if (fs != null && fs.isOpen()) { try (InputStream inputStream = fs.provider().newInputStream(path)) { ClassMethodSummaries classSummaries = new ClassMethodSummaries(clazz); summaryReader.read(new InputStreamReader(inputStream), classSummaries);
@Override public InputStream newInputStream(Path path, OpenOption... options) throws IOException { initStorage(); InputStream result = super.newInputStream(path, options); CloudStoragePath cloudPath = CloudStorageUtil.checkPath(path); int blockSize = cloudPath.getFileSystem().config().blockSize(); for (OpenOption option : options) { if (option instanceof OptionBlockSize) { blockSize = ((OptionBlockSize) option).size(); } } return new BufferedInputStream(result, blockSize); }
when(fileSystemProvider.newInputStream(path)).thenReturn(initialInputStream, updatedInputStream);