sears.tools
Class Utils

java.lang.Object
  extended by sears.tools.Utils

public class Utils
extends java.lang.Object

Class Utils.
Summary:
This class provides some useful subtitles and general tools.


Field Summary
static java.lang.String DOS_LINE_SEPARATOR
          DOS line separator, useful for some DVD/DVIX player
static java.lang.String gif
          Extension of gif file
static boolean isLinuxPlatform
          if is Linux OS
static boolean isMacPlatform
          if is Mac OS
static boolean isWindowsPlatform
          if is Windows OS
static java.lang.String jpeg
          Extension of jpeg file
static java.lang.String jpg
          Extension of jpg file
static java.lang.String LINE_SEPARATOR
          Line separator, system dependent
static java.lang.String OSname
          OS name
static java.lang.String png
          Extension of png file
static java.lang.String tif
          Extension of tif file
static java.lang.String tiff
          Extension of tiff file
 
Constructor Summary
Utils()
          Default constructor
 
Method Summary
static void copyFile(java.io.File src, java.io.File dst)
          Method copyFile.
static void copyStream(java.io.InputStream src, java.io.OutputStream dst)
          Method copyStream.
static java.lang.String formatTime(int timeInSecond)
          Method formatTime.
static java.lang.String getExtension(java.io.File file)
          Method getExtension.
static boolean isWindowsPlatform()
          Method isWindowsPlatform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jpeg

public static final java.lang.String jpeg
Extension of jpeg file

See Also:
Constant Field Values

jpg

public static final java.lang.String jpg
Extension of jpg file

See Also:
Constant Field Values

gif

public static final java.lang.String gif
Extension of gif file

See Also:
Constant Field Values

tiff

public static final java.lang.String tiff
Extension of tiff file

See Also:
Constant Field Values

tif

public static final java.lang.String tif
Extension of tif file

See Also:
Constant Field Values

png

public static final java.lang.String png
Extension of png file

See Also:
Constant Field Values

LINE_SEPARATOR

public static final java.lang.String LINE_SEPARATOR
Line separator, system dependent


DOS_LINE_SEPARATOR

public static final java.lang.String DOS_LINE_SEPARATOR
DOS line separator, useful for some DVD/DVIX player

See Also:
Constant Field Values

OSname

public static final java.lang.String OSname
OS name


isLinuxPlatform

public static final boolean isLinuxPlatform
if is Linux OS


isMacPlatform

public static final boolean isMacPlatform
if is Mac OS


isWindowsPlatform

public static final boolean isWindowsPlatform
if is Windows OS

Constructor Detail

Utils

public Utils()
Default constructor

Method Detail

getExtension

public static java.lang.String getExtension(java.io.File file)
Method getExtension.
Summary:
return the file extension of a given file. ex: from test.jpg, return String jpg

Parameters:
file - The File file to get the extension
Returns:
String The file extension.

isWindowsPlatform

public static boolean isWindowsPlatform()
Method isWindowsPlatform.
Summary:
Try to determine whether this application is running under Windows or some other platform by examing the "os.name" property.

Returns:
true if this application is running under a Windows OS

copyStream

public static void copyStream(java.io.InputStream src,
                              java.io.OutputStream dst)
                       throws java.io.IOException
Method copyStream.
Summary:
Copies src stream to dst stream. If the dst stream does not exist, it is created.

Parameters:
src - The File source stream
dst - The File destination stream
Throws:
java.io.IOException

copyFile

public static void copyFile(java.io.File src,
                            java.io.File dst)
                     throws java.io.IOException
Method copyFile.
Summary:
Copies src file to dst file. If the dst file does not exist, it is created.

Parameters:
src - The File source file
dst - The File destination file
Throws:
java.io.IOException

formatTime

public static java.lang.String formatTime(int timeInSecond)
Method formatTime.
Summary:
Format time in second to "HH:MM:SS".

Parameters:
timeInSecond - The int time in second
Returns:
the formated time