net.sourceforge.wurfl.core.resource
Class FileLoader

java.lang.Object
  extended by net.sourceforge.wurfl.core.resource.FileLoader

public final class FileLoader
extends Object

Loads a file. The file can be compresses by gzip or zip. In case of zip, the first entry will be processed.


Constructor Summary
FileLoader(File file)
          Build resource by File.
FileLoader(InputStream stream, String fileName)
          Build resource by InputStream.
FileLoader(String path)
          Build Resource by path.
FileLoader(URI uri)
          Build resource by URI.
 
Method Summary
static URI createURI(String path)
          Creates a URI from the given String.
 String getInfo()
          

If this resource is created using InputStream, the info will return Stream resource'.

 InputStream getStream()
           
 boolean isReloadable()
          Return if this resource can be reloaded.
protected  InputStream openInputStream(URI uri)
          Opens the InputStream by giving URI.
 void releaseAll()
           
 void resetStream()
           
static URI toURI(String location)
          Deprecated. use createURI(String)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLoader

public FileLoader(String path)
Build Resource by path. The path can be URI or filesystem path.

Parameters:
path - The path of source file.

FileLoader

public FileLoader(File file)
Build resource by File.

Parameters:
file - The source File

FileLoader

public FileLoader(URI uri)
Build resource by URI. It handle the 'classpath' schema also.

Parameters:
uri - The source URI

FileLoader

public FileLoader(InputStream stream,
                  String fileName)
Build resource by InputStream. The builded resource can be reloadable only if the given stream is resettable (the markSupported method returns true).

Parameters:
stream - The source stream.
Method Detail

getInfo

public String getInfo()

If this resource is created using InputStream, the info will return Stream resource'.


isReloadable

public boolean isReloadable()
Return if this resource can be reloaded.

Returns:
true if can be reloaded, false otherwise.

createURI

public static URI createURI(String path)
                     throws URISyntaxException
Creates a URI from the given String. If the path can be an URI representation or a filesystem path. It handle the Windows path also.

Throws:
URISyntaxException

toURI

public static URI toURI(String location)
                 throws URISyntaxException
Deprecated. use createURI(String)

Convert spaces to "%20"

Parameters:
location - Location to convert.
Returns:
converted location.
Throws:
URISyntaxException

openInputStream

protected InputStream openInputStream(URI uri)
Opens the InputStream by giving URI. The given URI support the 'classpath' schema also.

Parameters:
uri - The given URI
Returns:
The InputStream opened from the given URI

releaseAll

public void releaseAll()

getStream

public InputStream getStream()

resetStream

public void resetStream()


Copyright © 2012 ScientiaMobile Inc.. All Rights Reserved.