TrueUpdate Core 0.1.4

net.java.trueupdate.core.io
Class Sources

java.lang.Object
  extended by net.java.trueupdate.core.io.Sources

@Immutable
public class Sources
extends Object

Provides functions for Sources.

Author:
Christian Schlichtherle (copied and edited from TrueLicense Core 2.3.1)

Nested Class Summary
static interface Sources.BindStatement<V,X extends Exception>
           
static interface Sources.ExecuteStatement<V,X extends Exception>
           
 
Method Summary
static
<V,X extends Exception>
Sources.BindStatement<V,X>
bind(InputTask<V,X> task)
           
static
<V,X extends Exception>
Sources.ExecuteStatement<V,X>
execute(InputTask<V,X> task)
           
static Source forResource(String name, Class<?> clazz)
          Returns a source which loads the resource with the given name.
static Source forResource(String name, ClassLoader loader)
          Returns a source which loads the resource with the given name.
static Source forUrl(URL url)
          Returns a source which loads the entity of the given url.
static Source input()
          Returns a source which reads from standard input without ever closing it.
static Source uncloseable(InputStream in)
          Returns a source which reads from the given input stream and ignores any call to the InputStream.close() method of the input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

bind

public static <V,X extends Exception> Sources.BindStatement<V,X> bind(InputTask<V,X> task)

execute

public static <V,X extends Exception> Sources.ExecuteStatement<V,X> execute(InputTask<V,X> task)

forResource

public static Source forResource(String name,
                                 Class<?> clazz)
Returns a source which loads the resource with the given name. This method will use the given class to resolve the resource name and the class loader as described in Class.getResourceAsStream(String).

Parameters:
name - the name of the resource to load.
clazz - the class to use for loading the resource.
Returns:
A source which loads the resource with the given name.

forResource

public static Source forResource(String name,
                                 @CheckForNull
                                 ClassLoader loader)
Returns a source which loads the resource with the given name. If the given class loader is not null, then the resource will get loaded as described in ClassLoader.getResourceAsStream(String). Otherwise, the resource will get loaded as described in ClassLoader.getSystemResourceAsStream(String).

Parameters:
name - the name of the resource to load.
loader - the nullable class loader to use for loading the resource. If this is null, then the system class loader will get used.
Returns:
A source which loads the resource with the given name.

forUrl

public static Source forUrl(URL url)
Returns a source which loads the entity of the given url.

Parameters:
url - the URL.
Returns:
A source which loads the entity of the given url.

input

public static Source input()
Returns a source which reads from standard input without ever closing it.


uncloseable

public static Source uncloseable(InputStream in)
Returns a source which reads from the given input stream and ignores any call to the InputStream.close() method of the input stream.

Parameters:
in - the input stream to use.

TrueUpdate Core 0.1.4

Copyright © 2013 Stimulus Software. All rights reserved.