Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

create 'new File(URI)' from URL

 
Karsten Daemen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I'm trying to write a script that transfers a photo from a Facebook album to a Picasa album. I'm using the following code:

The part : "new File(fileURI)" crashes and gives the following exception:

Caused by: java.lang.IllegalArgumentException: URI scheme is not "file"
at java.io.File.<init>(File.java:366)

It seems that the new File(URI) constructor takes only URI's from files on the local HD.

Is there way to construct a File Object with an online source?

I try to avoid downloading all the pictures and uploading to Picasa since I work with GWT on google appengine so I can't write files on the server.

Thanks in advance!
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karsten Daemen wrote:It seems that the new File(URI) constructor takes only URI's from files on the local HD.
Yes, that's correct, that's what a File is.
Is there way to construct a File Object with an online source?
No.
I try to avoid downloading all the pictures and uploading to Picasa since I work with GWT on google appengine so I can't write files on the server.
I don't see why it's necessary to create a File object to do that. Did somebody else write that uploadToPicasa method which takes a File parameter and didn't provide any other overloaded versions? Or is there a version which takes an InputStream parameter, for example?
 
Karsten Daemen
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:I don't see why it's necessary to create a File object to do that. Did somebody else write that uploadToPicasa method which takes a File parameter and didn't provide any other overloaded versions? Or is there a version which takes an InputStream parameter, for example?


I didn't write that class indeed, the code is:

Javadoc for MediaFileSource and other classes

But I see now that myPhoto.setMediaSource() can also accept an MediaStreamSource, hopefully that will solve the problem ...

Thank You for the advice
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!