Hello,

yes you always need a configured FSM for anything VFS. If you do not
have special needs you can use the "system global" auto configured one:

FileObject fo = VFS.getManager().toFileObject(file);

See also http://commons.apache.org/proper/commons-vfs/api.html

Gruss
Bernd


 Am Sat, 25 Jul 2015
18:28:36 +0300 schrieb Alexander Nozik <alta...@gmail.com>:

> Tried that. In order to do so, I need to create that manager first.
> If I try to create either DefaultFileSystemManager or 
> StandardFileSystemManager and use them, I get "FileSystemException: 
> Could not find a file provider which can handle local files." in both 
> cases. I believe I need to somehow build a provider for local files,
> but it not obvious from documentation how to do so. If I try to use 
> DefaultLocalFileProvider directly it throws internal
> NullPointerException. Could you provide a code to build local file
> system?
> 
> 
> On 25-Jul-15 18:17, Bernd Eckenfels wrote:
> > Hello,
> >
> > you can use FileSystemManager.toFileObject(File):
> >
> > https://commons.apache.org/proper/commons-vfs/apidocs/org/apache/commons/vfs2/FileSystemManager.html#toFileObject%28java.io.File%29
> >
> > Gruss
> > Bernd
> >
> > Am Sat, 25 Jul 2015 18:13:14 +0300
> > schrieb Alexander Nozik <alta...@gmail.com>:
> >
> >> Hello,
> >> I've got a program, part of which is based on regular local file
> >> system and part is file system independent. So sometimes I need to
> >> convert regular local Files to VFS FileObjects. What is the
> >> simplest way to do that? It should be very simple, but I haven't
> >> found it in the documentations.
> >>
> >> With best regards, Alexander Nozik.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> >> For additional commands, e-mail: user-h...@commons.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > For additional commands, e-mail: user-h...@commons.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to