org.specrunner.util
Class UtilIO

java.lang.Object
  extended by org.specrunner.util.UtilIO

public final class UtilIO
extends Object

IO utilities.

Author:
Thiago Santos

Field Summary
static int BUFFER_SIZE
          Reading buffer size.
protected static ICache<URL,byte[]> cache
          Cache of resources.
 
Method Summary
static InputStream[] getInputStreams(List<URL> files)
          Get all input streams for the given URL list.
static InputStream getStream(URL url)
          Get stream for a given URL.
static void pressKey()
          Request for key interaction.
static void writeAllTo(List<URL> files, OutputStream out)
          Write all contents to a output.
static void writeTo(InputStream in, OutputStream out)
          Write a input stream to a output.
static void writeToClose(URL url, File file)
          Write the URL input to the file output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected static ICache<URL,byte[]> cache
Cache of resources. Avoid unnecessary file/network/jar accesses.


BUFFER_SIZE

public static final int BUFFER_SIZE
Reading buffer size.

See Also:
Constant Field Values
Method Detail

writeAllTo

public static void writeAllTo(List<URL> files,
                              OutputStream out)
                       throws ResourceException
Write all contents to a output.

Parameters:
files - The input list.
out - The output.
Throws:
ResourceException - On writing errors.

getInputStreams

public static InputStream[] getInputStreams(List<URL> files)
                                     throws ResourceException
Get all input streams for the given URL list.

Parameters:
files - The files.
Returns:
The input stream list.
Throws:
ResourceException - On loading errors.

getStream

public static InputStream getStream(URL url)
                             throws IOException
Get stream for a given URL.

Parameters:
url - The url.
Returns:
The stream.
Throws:
IOException - On load errors.

writeTo

public static void writeTo(InputStream in,
                           OutputStream out)
                    throws IOException
Write a input stream to a output.

Parameters:
in - The input.
out - The output.
Throws:
IOException - On writing errors.

writeToClose

public static void writeToClose(URL url,
                                File file)
                         throws IOException
Write the URL input to the file output.

Parameters:
url - The input.
file - The output.
Throws:
IOException - On writing errors.

pressKey

public static void pressKey()
                     throws IOException
Request for key interaction.

Throws:
IOException - On errors.


Copyright © 2014. All rights reserved.