net.sourceforge.openstego.util
Class CommonUtil

java.lang.Object
  extended bynet.sourceforge.openstego.util.CommonUtil

public class CommonUtil
extends java.lang.Object

Common utilities for OpenStego


Constructor Summary
CommonUtil()
           
 
Method Summary
static byte[] getFileBytes(java.io.File file)
          Method to get byte array data from given file
static byte[] getStreamBytes(java.io.InputStream is)
          Method to get byte array data from given InputStream
static void setEnabled(javax.swing.JTextField textField, boolean enabled)
          Method to enable/disable a Swing JTextField object
static void writeFile(byte[] fileData, java.lang.String fileName)
          Method to write file data to disk
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonUtil

public CommonUtil()
Method Detail

getStreamBytes

public static byte[] getStreamBytes(java.io.InputStream is)
                             throws OpenStegoException
Method to get byte array data from given InputStream

Parameters:
is - InputStream to read
Returns:
Stream data as byte array
Throws:
OpenStegoException

getFileBytes

public static byte[] getFileBytes(java.io.File file)
                           throws OpenStegoException
Method to get byte array data from given file

Parameters:
file - File to read
Returns:
File data as byte array
Throws:
OpenStegoException

writeFile

public static void writeFile(byte[] fileData,
                             java.lang.String fileName)
                      throws OpenStegoException
Method to write file data to disk

Parameters:
fileData - File data
fileName - File name (If this is null, then data is written to stdout)
Throws:
OpenStegoException

setEnabled

public static void setEnabled(javax.swing.JTextField textField,
                              boolean enabled)
Method to enable/disable a Swing JTextField object

Parameters:
textField - Swing JTextField object
enabled - Flag to indicate whether to enable or disable the object