Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.util
Class NetUtil  view NetUtil download NetUtil.java

java.lang.Object
  extended bycom.eireneh.util.NetUtil

public class NetUtil
extends java.lang.Object

The NetUtil class looks after general utility stuff around the java.net package.
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.

Version:
D0.I0.T0

Constructor Summary
private NetUtil()
          Basic constructor - ensure that we can't be instansiated
 
Method Summary
static boolean delete(java.net.URL orig)
          Delete a URL.
static java.io.OutputStream getOutputStream(java.net.URL url)
          Attempt to obtain an OutputStream from a URL.
static java.io.OutputStream getOutputStream(java.net.URL url, boolean append)
          Attempt to obtain an OutputStream from a URL.
static boolean isDirectory(java.net.URL orig)
          If there is a directory at the other end of this URL return true.
static boolean isFile(java.net.URL orig)
          If there is a file at the other end of this URL return true.
static java.net.URL lengthenURL(java.net.URL orig, java.lang.String extra)
          Utility to add a string to the end of a URL.
static java.net.URL lengthenURL(java.net.URL orig, java.lang.String extra1, java.lang.String extra2)
          Utility to add a string to the end of a URL.
static java.net.URL lengthenURL(java.net.URL orig, java.lang.String extra1, java.lang.String extra2, java.lang.String extra3)
          Utility to add a string to the end of a URL.
static void makeDirectory(java.net.URL orig)
          If the directory does not exist, create it.
static void makeFile(java.net.URL orig)
          If the file does not exist, create it.
static boolean move(java.net.URL old_url, java.net.URL new_url)
          Move a URL from one place to another.
static java.net.URL shortenURL(java.net.URL orig, java.lang.String strip)
          Utility to strip a string from the end of a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetUtil

private NetUtil()
Basic constructor - ensure that we can't be instansiated

Method Detail

makeDirectory

public static void makeDirectory(java.net.URL orig)
                          throws java.net.MalformedURLException
If the directory does not exist, create it. Note this currently only works with file: type URLs


makeFile

public static void makeFile(java.net.URL orig)
                     throws java.net.MalformedURLException,
                            java.io.IOException
If the file does not exist, create it. Note this currently only works with file: type URLs


isFile

public static boolean isFile(java.net.URL orig)
                      throws java.net.MalformedURLException
If there is a file at the other end of this URL return true. Note this currently only works with file: type URLs


isDirectory

public static boolean isDirectory(java.net.URL orig)
                           throws java.net.MalformedURLException
If there is a directory at the other end of this URL return true. Note this currently only works with file: type URLs


move

public static boolean move(java.net.URL old_url,
                           java.net.URL new_url)
                    throws java.io.IOException
Move a URL from one place to another. Currently this only works for file: URLs, however the interface should not need to change to handle more complex URLs


delete

public static boolean delete(java.net.URL orig)
                      throws java.io.IOException
Delete a URL. Currently this only works for file: URLs, however the interface should not need to change to handle more complex URLs


shortenURL

public static java.net.URL shortenURL(java.net.URL orig,
                                      java.lang.String strip)
                               throws java.net.MalformedURLException
Utility to strip a string from the end of a URL.


lengthenURL

public static java.net.URL lengthenURL(java.net.URL orig,
                                       java.lang.String extra)
                                throws java.net.MalformedURLException
Utility to add a string to the end of a URL.


lengthenURL

public static java.net.URL lengthenURL(java.net.URL orig,
                                       java.lang.String extra1,
                                       java.lang.String extra2)
                                throws java.net.MalformedURLException
Utility to add a string to the end of a URL.


lengthenURL

public static java.net.URL lengthenURL(java.net.URL orig,
                                       java.lang.String extra1,
                                       java.lang.String extra2,
                                       java.lang.String extra3)
                                throws java.net.MalformedURLException
Utility to add a string to the end of a URL.


getOutputStream

public static java.io.OutputStream getOutputStream(java.net.URL url)
                                            throws java.io.IOException
Attempt to obtain an OutputStream from a URL. The simple case will just call url.openConnection().getOutputStream(), however in some JVMs (MS at least this fails where new FileOutputStream(url) works. So if openConnection().getOutputStream() fails and the protocol is file, then the alternate version is used.


getOutputStream

public static java.io.OutputStream getOutputStream(java.net.URL url,
                                                   boolean append)
                                            throws java.io.IOException
Attempt to obtain an OutputStream from a URL. The simple case will just call url.openConnection().getOutputStream(), however in some JVMs (MS at least this fails where new FileOutputStream(url) works. So if openConnection().getOutputStream() fails and the protocol is file, then the alternate version is used.