InputSocket<?> getInputSocket( TPath path, BitField<FsInputOption> options) { return getController() .getInputSocket(path.getEntryName(), options); }
InputStream newInputStream(TPath path, OpenOption... options) throws IOException { return getController() .getInputSocket( path.getEntryName(), path.mapInput(options)) .newInputStream(); }
/** * Returns an input socket for the given file. * * @param src the file to read. * @param options the options for accessing the file. * @return An input socket for the given file. */ @SuppressWarnings("deprecation") static InputSocket<?> getInputSocket(final File src, final BitField<FsInputOption> options) { if (src instanceof TFile) { final TFile tsrc = (TFile) src; final TFile archive = tsrc.getInnerArchive(); if (null != archive) return archive .getController() .getInputSocket(tsrc.getInnerFsEntryName(), options); } final FsPath path = new FsPath(src); return TConfig .get() .getFsManager() .getController( path.getMountPoint(), getDetector(src)) .getInputSocket(path.getEntryName(), options); }
SeekableByteChannel newByteChannel( final TPath path, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs) throws IOException { final FsEntryName name = path.getEntryName(); final FsController<?> controller = getController(); if (options.isEmpty() || options.contains(StandardOpenOption.READ)) { final BitField<FsInputOption> o = path.mapInput(options).set(FsInputOption.CACHE); return controller .getInputSocket(name, o) .newSeekableByteChannel(); } else { final BitField<FsOutputOption> o = path.mapOutput(options).set(FsOutputOption.CACHE); try { return controller .getOutputSocket(name, o, null) .newSeekableByteChannel(); } catch (final IOException ex) { if (o.get(EXCLUSIVE) && null != controller.getEntry(name)) throw (IOException) new FileAlreadyExistsException(path.toString()) .initCause(ex); throw ex; } } }
InputSocket<?> socket = manager .getController( path.getMountPoint(), driver) .getInputSocket( path.getEntryName(), BitField.noneOf(FsInputOption.class));
InputSocket<?> srcSocket = manager .getController( srcPath.getMountPoint(), driver) .getInputSocket( srcPath.getEntryName(), BitField.noneOf(FsInputOption.class));