gov.nasa.gsfc.hessi.jidl.prep.server
Class Utility

java.lang.Object
  extended by gov.nasa.gsfc.hessi.jidl.prep.server.Utility

public class Utility
extends java.lang.Object

This is a utility class that deals with often used general purpose tasks.

Since:
Revision 1
Author:
Laszlo Istvan Etesi

Field Summary
(package private) static org.apache.log4j.Logger logger
          Logger instance
 
Constructor Summary
Utility()
           
 
Method Summary
static byte[] getDataFromRepository(java.net.URL url)
          This method reads binary data from an http repository
static byte[] readByteArrayFromFile(java.lang.String filePath)
          Reads binary data from a file
static java.io.File writeByteArrayToFile(byte[] data, java.io.File file)
          This method allows to write binary data to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
Logger instance

Constructor Detail

Utility

public Utility()
Method Detail

writeByteArrayToFile

public static java.io.File writeByteArrayToFile(byte[] data,
                                                java.io.File file)
                                         throws java.io.IOException
This method allows to write binary data to a file

Parameters:
data - is the binary data to be written
file - is the file to where the data is written to
Returns:
the input file which now contains the binary data
Throws:
java.io.IOException

readByteArrayFromFile

public static byte[] readByteArrayFromFile(java.lang.String filePath)
                                    throws java.io.IOException
Reads binary data from a file

Parameters:
filePath - from where the data should be read
Returns:
a byte[] containing the read data.
Throws:
java.io.IOException

getDataFromRepository

public static byte[] getDataFromRepository(java.net.URL url)
                                    throws java.io.IOException
This method reads binary data from an http repository

Parameters:
url - points to the http repository
Returns:
a byte[] containing the data
Throws:
java.io.IOException