tribble.io
Class UrlTyper

java.lang.Object
  extended by tribble.io.UrlTyper

public class UrlTyper
extends java.lang.Object

Simple URL reader.

Opens and reads the contents of a given URL address, displaying the contents to the standard output.

Since:
2001-01-06
Version:
$Revision: 1.2 $ $Date: 2001/01/06 18:47:23 $
Author:
David R. Tribble, david@tribble.com
Copyright 2001 by David R. Tribble, all rights reserved.
Permission is granted to freely use and distribute this source code provided that the original copyright and authorship notices remain intact.

Field Summary
static int BUF_SIZE
          Data byte buffer size (in bytes).
(package private) static java.lang.String COPYRIGHT
          Embedded copyright notice.
(package private) static java.lang.String REV
          Revision information.
 
Method Summary
static long copy(java.net.URL url, java.io.OutputStream out)
          Opens a given URL address and reads its contents, copying them to an output stream.
static void main(java.lang.String[] args)
          Runs this program.
protected static void run(java.lang.String[] args)
          Runs this class as a program.
protected static void usage()
          Displays a usage message for this program, then punts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values

COPYRIGHT

static final java.lang.String COPYRIGHT
Embedded copyright notice.

See Also:
Constant Field Values

BUF_SIZE

public static final int BUF_SIZE
Data byte buffer size (in bytes).

See Also:
Constant Field Values
Method Detail

main

public static void main(java.lang.String[] args)
Runs this program.

Parameters:
args - The command line arguments.
Since:
1.1, 2001-01-06

copy

public static long copy(java.net.URL url,
                        java.io.OutputStream out)
                 throws java.io.IOException
Opens a given URL address and reads its contents, copying them to an output stream.

Parameters:
url - The URL to open and read.
out - The output stream to write to.
Returns:
The total number of bytes read and copied.
Throws:
java.io.IOException - Thrown if a read or write error occurs.
Since:
1.1, 2001-01-06

run

protected static void run(java.lang.String[] args)
Runs this class as a program.

Since:
1.1, 2001-01-06

usage

protected static void usage()
Displays a usage message for this program, then punts.

This does not return, but calls System.exit(int).

Since:
1.1, 2001-01-06