Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [geclipse-dev] Open InputStream

POD69@xxxxxxx pisze:
Hi all

I dont know whats wrong with that code?
That should open a Stream on the getutor.t01 file and print out its content? Whats wrong with that? Am I wrong.

URI uri = new URI("gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor/getutor.t01";); IFileStore fs = EFS.getStore( uri ); BufferedInputStream stream = new BufferedInputStream(fs.openInputStream(EFS.NONE, null)); while(stream.available() != 0)
           System.out.print((char)stream.read());


As I replied to Romain (in one post nearby):

Also I didn't figure out how to perform fetchInfo for a single file, without listing whole directory. Hence, if you would like to download a single file, you should perform this cumbersome usecase (in pseudocode): fs = getFileStore (new URI("gsiftp://server:2811/path/to/the/parent/directory/";) )
find in fs.childStores your desired file, call it fsfile

fsfile.get(Input|Output)Stream();

So, in your case it would look like this:
URI uri = new URI("gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor/";);
IFileStore file;

IFileStore fs = EFS.getStore( uri );
for (IFileStore store : fs.childStores() ) {
  if ( store.getName().equals("getutor.t01") ) {
    file = store;
    break;
  }
}


BufferedInputStream stream = new BufferedInputStream(file.openInputStream(EFS.NONE, null));
 while(stream.available() != 0)
            System.out.print((char)stream.read());


and that URI uri = new URI("gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor/foofo/";); IFileStore fs = EFS.getStore( uri );
Please try to invoke #childStores() or childNames() here
    IFileStore homeDir = fileSystem.getStore(URI.create("/home/pod/files/"));
	        fs.copy(homeDir, EFS.OVERWRITE, null);

should copy all files and dirs recursively - but doesnt work ?

the only thing that works is fs.mkdir() I can create a dir.

So what to do?

hope this helps.
I'll be here for next 1hr in case you need more help :-)

--
Mateusz Pabis


Back to the top