[VFS] reading a file from a tgz archive on an sftp server

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[VFS] reading a file from a tgz archive on an sftp server

Mark Shifman
I would like to read a file in a tgz archive located on an sftp server.

I can get a file object
FileObject fo_test=  fsManager.resolveFile(
"sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz")

but I don't know how to read a file in this object or make the
fileobject into something with children.

any help would be appreciated.
mas


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] reading a file from a tgz archive on an sftp server

Mario Ivankovits
Hi!
> FileObject fo_test=  fsManager.resolveFile(
> "sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz")
>
> but I don't know how to read a file in this object or make the
> fileobject into something with children.
please try
FileObject fo_test=  fsManager.resolveFile(
"tgz:sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz!")

---
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] reading a file from a tgz archive on an sftp server

Mark Shifman
Mario Ivankovits wrote:

> Hi!
>
>> FileObject fo_test=  fsManager.resolveFile(
>> "sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz")
>>
>> but I don't know how to read a file in this object or make the
>> fileobject into something with children.
>
> please try
> FileObject fo_test=  fsManager.resolveFile(
> "tgz:sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz!")
>
It threw the following.
org.apache.commons.vfs.FileSystemException: Badly formed URI
"tgz:sftp://myname:mypasswd@myhost/pathtofle/myfile.tgz!".
    at
org.apache.commons.vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:85)
    at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:532)
    at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:486)
    at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:456)
    at org.ycmi.itraq.itraq_calc.main(itraq_calc.java:117)
Caused by: java.net.MalformedURLException: unknown protocol: tgz
    at java.net.URL.<init>(URL.java:544)
    at java.net.URL.<init>(URL.java:434)
    at java.net.URL.<init>(URL.java:383)
    at
org.apache.commons.vfs.provider.url.UrlFileProvider.findFile(UrlFileProvider.java:66)
    ... 4 more

> ---
> Mario
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


--
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] reading a file from a tgz archive on an sftp server

Mario Ivankovits
Mark Shifman wrote:

>>> FileObject fo_test=  fsManager.resolveFile(
>>> "sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz")
>>>
>>> but I don't know how to read a file in this object or make the
>>> fileobject into something with children.
>>
>> please try
>> FileObject fo_test=  fsManager.resolveFile(
>> "tgz:sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz!")
>>
> It threw the following.
> org.apache.commons.vfs.FileSystemException: Badly formed URI
> "tgz:sftp://myname:mypasswd@myhost/pathtofle/myfile.tgz!".
Do you have commons-compress in your classpath? Its needed to unpack tar
files.

Please refer to http://jakarta.apache.org/commons/vfs/download.html 
where to find the jar file.

VFS silently do not install a fileprovider if a optional library isnt
available - and from your stacktrace VFS falls back to the default
fileprovider which dont know how to handle tgz files.

---
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [VFS] reading a file from a tgz archive on an sftp server

Mark Shifman
Thanks!!
It worked when I added the compress jar to the path.

mas

Mario Ivankovits wrote:

> Mark Shifman wrote:
>
>>>> FileObject fo_test=  fsManager.resolveFile(
>>>> "sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz")
>>>>
>>>> but I don't know how to read a file in this object or make the
>>>> fileobject into something with children.
>>>
>>>
>>> please try
>>> FileObject fo_test=  fsManager.resolveFile(
>>> "tgz:sftp://myname:mypasswd@myhost/pathtofile/myfile.tgz!")
>>>
>> It threw the following.
>> org.apache.commons.vfs.FileSystemException: Badly formed URI
>> "tgz:sftp://myname:mypasswd@myhost/pathtofle/myfile.tgz!".
>
> Do you have commons-compress in your classpath? Its needed to unpack
> tar files.
>
> Please refer to http://jakarta.apache.org/commons/vfs/download.html 
> where to find the jar file.
>
> VFS silently do not install a fileprovider if a optional library isnt
> available - and from your stacktrace VFS falls back to the default
> fileprovider which dont know how to handle tgz files.
>
> ---
> Mario
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


--
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]