edu.jhu.ece.iacl.jist.utility
Class FileUtil

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.utility.FileUtil

public class FileUtil
extends java.lang.Object

The Class FileUtil.


Field Summary
static int COMPRESSION_GZIP
          The Constant COMPRESSION_GZIP.
static int COMPRESSION_NONE
          The Constant COMPRESSION_NONE.
static int COMPRESSION_ZIP
          The Constant COMPRESSION_ZIP.
 
Constructor Summary
FileUtil()
           
 
Method Summary
static java.lang.String forceSafeFilename(java.lang.String filenameNoPath)
          Replace any potentially unsafe file system characters with "_".
static java.lang.String recoverUnsafeFilename(java.lang.String filenameNoPath)
          Recover unsafe filename.
static java.io.PrintStream[] redirect(java.io.File fout, java.io.File ferr)
          Redirect stdout and stderr to files.
static void restoreRedirect()
           
static void setModelImageCompression(ModelImage resultImage, int compressionType)
          Sets the model image compression.
static void updateFileInfo(FileInfoBase info, ModelImage resultImage)
          Copy important file information between ModelImage structures, assuming all slices have same properties (uses only the first slice from the source).
static void updateFileInfo(ModelImage image, ModelImage resultImage)
          Copy important file information between ModelImage structures, assuming all slices have same properties (uses only the first slice from the source).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPRESSION_GZIP

public static final int COMPRESSION_GZIP
The Constant COMPRESSION_GZIP.


COMPRESSION_ZIP

public static final int COMPRESSION_ZIP
The Constant COMPRESSION_ZIP.


COMPRESSION_NONE

public static final int COMPRESSION_NONE
The Constant COMPRESSION_NONE.

Constructor Detail

FileUtil

public FileUtil()
Method Detail

redirect

public static java.io.PrintStream[] redirect(java.io.File fout,
                                             java.io.File ferr)
Redirect stdout and stderr to files.

Parameters:
fout - file for stdout
ferr - file for stderr
Returns:
the prints the stream[]

restoreRedirect

public static void restoreRedirect()

updateFileInfo

public static final void updateFileInfo(ModelImage image,
                                        ModelImage resultImage)
Copy important file information between ModelImage structures, assuming all slices have same properties (uses only the first slice from the source).

Parameters:
image - the image
resultImage - the result image

setModelImageCompression

public static final void setModelImageCompression(ModelImage resultImage,
                                                  int compressionType)
Sets the model image compression.

Parameters:
resultImage - the result image
compressionType - the compression type

updateFileInfo

public static final void updateFileInfo(FileInfoBase info,
                                        ModelImage resultImage)
Copy important file information between ModelImage structures, assuming all slices have same properties (uses only the first slice from the source).

Parameters:
info - the info
resultImage - the result image

forceSafeFilename

public static java.lang.String forceSafeFilename(java.lang.String filenameNoPath)
Replace any potentially unsafe file system characters with "_".

Parameters:
filenameNoPath - the filename no path
Returns:
the string

recoverUnsafeFilename

public static java.lang.String recoverUnsafeFilename(java.lang.String filenameNoPath)
Recover unsafe filename.

Parameters:
filenameNoPath - the filename no path
Returns:
the string