org.placidus.util
Class StreamHelper

java.lang.Object
  extended by org.placidus.util.StreamHelper

public class StreamHelper
extends java.lang.Object


Constructor Summary
StreamHelper()
           
 
Method Summary
static long getAdlerSum(java.io.InputStream inputStream)
           
static long getCheckSum(java.io.InputStream inputStream, java.util.zip.Checksum checkSum)
          This will calculate the given checksumtype of the filecontent for the given name
static long getCRC32Sum(java.io.InputStream inputStream)
           
static java.io.InputStream getInputStreamForName(java.lang.String resourceName)
          Creates a new input stream for given resourcename with classloader of current thread
static byte[] getOutput(java.io.InputStream is)
          This function reads the output of a given inputstream with all conditions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamHelper

public StreamHelper()
Method Detail

getInputStreamForName

public static java.io.InputStream getInputStreamForName(java.lang.String resourceName)
                                                 throws java.io.IOException,
                                                        java.net.URISyntaxException
Creates a new input stream for given resourcename with classloader of current thread

Parameters:
resourceName - to load
Returns:
new inputstream
Throws:
java.io.IOException
java.net.URISyntaxException

getOutput

public static byte[] getOutput(java.io.InputStream is)
                        throws java.io.IOException
This function reads the output of a given inputstream with all conditions

Parameters:
is - given inputstream to read
Returns:
a bytearray of the read content
Throws:
java.io.IOException - if an IO Error occurs

getCRC32Sum

public static long getCRC32Sum(java.io.InputStream inputStream)
                        throws java.io.IOException,
                               java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException

getAdlerSum

public static long getAdlerSum(java.io.InputStream inputStream)
                        throws java.io.IOException,
                               java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException

getCheckSum

public static long getCheckSum(java.io.InputStream inputStream,
                               java.util.zip.Checksum checkSum)
                        throws java.io.IOException,
                               java.net.URISyntaxException
This will calculate the given checksumtype of the filecontent for the given name

Parameters:
inputStream - to load and build checksum for
checkSum - checksum object to build sum
Returns:
checksum of file, 0 if inputstream for file can not be created
Throws:
java.io.IOException - content can not be read
java.net.URISyntaxException - if uri of fileName is not well formed


Copyright © 2006 DS. All Rights Reserved.