You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Mark Shifman <ma...@yale.edu> on 2005/08/23 18:28:28 UTC

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

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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


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

Posted by Mark Shifman <ma...@yale.edu>.
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: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 mark.shifman@yale.edu


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


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

Posted by Mario Ivankovits <ma...@ops.co.at>.
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


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

Posted by Mark Shifman <ma...@yale.edu>.
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: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 mark.shifman@yale.edu


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


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

Posted by Mario Ivankovits <ma...@ops.co.at>.
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: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org