HTML5 Canvas
Written by: Simon Sarris
Featured Refcardz: Top Refcardz:
  1. Apache Hadoop
  2. Web Driver
  3. MVVM
  4. REST
  5. ADO.NET
  1. HTML5
  2. Ajax
  3. jQuery Selectors
  4. CSS Part 1
  5. Git

Link Details

Link 3108 thumbnail
User 200810 avatar

By 3monkeys
via java.sys-con.com
Published: Sep 14 2006 / 12:16

Just open the stream over the network. Java has a class URL that will help you to connect to a remote computer on the Internet.
  • 10
  • 0
  • 958
  • 0

Comments

Add your comment
User 202710 avatar

wytten replied ago:

1 votes Vote down Vote up Reply

Why is he reading 1 byte at a time in FileDownloader

User 190346 avatar

ilazarte replied ago:

1 votes Vote down Vote up Reply

Commons IO:
http://jakarta.apache.org/commons/io/description.html

InputStream in = new URL ("http://jakarta.apache.org").openStream();
try {
System.out.println( IOUtils.toString( in ) );
} finally {
IOUtils.closeQuietly(in);
}

User 200810 avatar

3monkeys replied ago:

0 votes Vote down Vote up Reply

From ilazarte's article, for a little added clarity:
<quote>In certain application domains, such IO operations are common, and this class can save a great deal of time. And you can rely on well-tested code.

For utility code such as this, flexibility and speed are of primary importance. However you should also understand the limitations of this approach. Using the above technique to read a 1GB file would result in an attempt to create a 1GB String object!<quote>

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (10)



Voters Against This Link (0)