net.sourceforge.openstego.util
Class CommonUtil

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

public class CommonUtil
extends Object

Common utilities for OpenStego


Constructor Summary
CommonUtil()
           
 
Method Summary
static byte[] getFileBytes(File file)
          Method to get byte array data from given file
static byte[] getStreamBytes(InputStream is)
          Method to get byte array data from given InputStream
static List parseFileList(String fileList, String delimiter)
          Method to parse a delimiter separated list of files into arraylist of filenames.
static void setEnabled(JTextField textField, boolean enabled)
          Method to enable/disable a Swing JTextField object
static void writeFile(byte[] fileData, File file)
          Method to write file data to disk
static void writeFile(byte[] fileData, 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(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(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,
                             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

writeFile

public static void writeFile(byte[] fileData,
                             File file)
                      throws OpenStegoException
Method to write file data to disk

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

setEnabled

public static void setEnabled(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

parseFileList

public static List parseFileList(String fileList,
                                 String delimiter)
Method to parse a delimiter separated list of files into arraylist of filenames. It supports wildcard characters "*" and "?" within the filenames.

Parameters:
fileList - Delimiter separated list of filenames
delimiter - Delimiter for tokenization
Returns:
List of filenames after tokenizing and wildcard expansion


Copyright © 2007-2008 Samir Vaidya. All Rights Reserved.