org.archive.crawler.util
Class IoUtils

java.lang.Object
  extended by org.archive.crawler.util.IoUtils

public class IoUtils
extends java.lang.Object

Logging utils.

Author:
stack

Constructor Summary
IoUtils()
           
 
Method Summary
static java.io.InputStream getInputStream(java.io.File basedir, java.lang.String pathOrUrl)
          Get inputstream.
static java.io.InputStream getInputStream(java.lang.String pathOrUrl)
           
static void unzip(java.io.File zipFile, java.io.File destinationDir)
          Use ant to unjar.
static void unzip(java.io.File zipFile, java.io.File destinationDir, boolean overwrite)
          Use ant to unjar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IoUtils

public IoUtils()
Method Detail

getInputStream

public static java.io.InputStream getInputStream(java.lang.String pathOrUrl)

getInputStream

public static java.io.InputStream getInputStream(java.io.File basedir,
                                                 java.lang.String pathOrUrl)
Get inputstream. This method looks at passed string and tries to judge it a filesystem path or an URL. It then gets an InputStream on to the file or URL.

ASSUMPTION: Scheme on any url will probably only ever be 'file' or 'http'.

Parameters:
basedir - If passed fileOrUrl is a file path and it is not absolute, prefix with this basedir (May be null then no prefixing will be done).
pathOrUrl - Pass path to a file on disk or pass in a URL.
Returns:
An input stream.

unzip

public static void unzip(java.io.File zipFile,
                         java.io.File destinationDir)
Use ant to unjar.

Parameters:
zipFile - File to unzip.
destinationDir - Where to unzip to.

unzip

public static void unzip(java.io.File zipFile,
                         java.io.File destinationDir,
                         boolean overwrite)
Use ant to unjar.

Parameters:
zipFile - File to unzip.
destinationDir - Where to unzip to.
overwrite - Whether to overwrite existing content.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.