org.ow2.weblab.content.api
Class ContentUtil

java.lang.Object
  extended by org.ow2.weblab.content.api.ContentUtil

public class ContentUtil
extends java.lang.Object


Constructor Summary
ContentUtil()
           
 
Method Summary
static java.lang.String convertToHex(byte[] data)
           
static void copyFile(java.io.File file, java.io.File newFile)
           
static boolean equals(byte[] one, byte[] another)
           
static boolean equals(java.io.File one, java.io.File another)
           
static java.lang.String getPropertyValue(java.lang.String propertyPath, java.lang.String propertyValue, java.lang.String defaultValue)
          Uses this to automatically get a folder path.
static java.lang.String SHA1(byte[] dataBytes)
           
static java.lang.String SHA1(java.io.File in)
           
static void writeStream(java.io.InputStream is, java.io.OutputStream os)
          Read input from input stream and write it to output stream until there is no more input from input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentUtil

public ContentUtil()
Method Detail

getPropertyValue

public static java.lang.String getPropertyValue(java.lang.String propertyPath,
                                                java.lang.String propertyValue,
                                                java.lang.String defaultValue)
Uses this to automatically get a folder path. Load it from a property file.

Parameters:
propertyPath - path to the property file.
propertyValue - name of the key in the property file.
defaultValue - value returned if unable to get one.
Returns:
the path to the file repository folder.

writeStream

public static void writeStream(java.io.InputStream is,
                               java.io.OutputStream os)
                        throws java.io.IOException
Read input from input stream and write it to output stream until there is no more input from input stream.

Parameters:
is - input stream the input stream to read from.
os - output stream the output stream to write to.
buf - the byte array to use as a buffer
Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.File file,
                            java.io.File newFile)
                     throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Parameters:
file - Input file
newFile - Output file
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException - If an IOException occurs.

equals

public static boolean equals(java.io.File one,
                             java.io.File another)
                      throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

equals

public static boolean equals(byte[] one,
                             byte[] another)
                      throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

SHA1

public static java.lang.String SHA1(java.io.File in)
                             throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

SHA1

public static java.lang.String SHA1(byte[] dataBytes)
                             throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
Throws:
org.ow2.weblab.core.extended.exception.WebLabCheckedException

convertToHex

public static java.lang.String convertToHex(byte[] data)


Copyright © 2004-2011. All Rights Reserved.