Class SCFormatUtil

java.lang.Object
  |
  +--SCFormatUtil

public class SCFormatUtil
extends java.lang.Object


Field Summary
static java.lang.String[] NUM
           
static java.lang.String[] REG
           
 
Constructor Summary
SCFormatUtil()
           
 
Method Summary
static java.lang.String fixLength(java.lang.String arg, int leng)
          Converts a String argument to a specified length.
static boolean hasSpace(java.lang.String arg)
          Checks if a String contains one or more white space characters.
static boolean hasTab(java.lang.String arg)
          Checks if a String contains one or more tab characters.
static boolean isValidObjCode(java.lang.String arg)
          Checks if a line of object code is valid.
static java.io.PrintWriter openDstFile(java.lang.String dstFileName)
          Opens/Creates destination file for output
static java.io.BufferedReader openSrcFile(java.lang.String srcFileName)
          Opens source file for input.
static java.lang.String toFourHex(int arg)
          Converts an integer to Hex string of length 2.
static int toInteger(java.lang.String arg)
          Converts a String argument to an int value.
static java.lang.String toTwoHex(int arg)
          Converts an integer to Hex string of length 2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REG

public static final java.lang.String[] REG

NUM

public static final java.lang.String[] NUM
Constructor Detail

SCFormatUtil

public SCFormatUtil()
Method Detail

toFourHex

public static java.lang.String toFourHex(int arg)
Converts an integer to Hex string of length 2.


toTwoHex

public static java.lang.String toTwoHex(int arg)
Converts an integer to Hex string of length 2.


isValidObjCode

public static boolean isValidObjCode(java.lang.String arg)
Checks if a line of object code is valid. Checks 4 aspects: no tab, no space, charAt(4) == ':', and length <= 21. Any violation of the above rules results false.

Parameters:
arg - argument to be checked
Returns:
boolean whether the argument is a line of valid object code

toInteger

public static int toInteger(java.lang.String arg)
                     throws java.lang.NumberFormatException
Converts a String argument to an int value.

Parameters:
arg - argument to be converted
Returns:
integer representation of the argument
java.lang.NumberFormatException

hasTab

public static boolean hasTab(java.lang.String arg)
Checks if a String contains one or more tab characters.

Parameters:
arg - argument to be checked
Returns:
boolean whether the argument contains a tab character

hasSpace

public static boolean hasSpace(java.lang.String arg)
Checks if a String contains one or more white space characters.

Parameters:
arg - argument to be checked
Returns:
boolean whether the argument contains a tab character

fixLength

public static java.lang.String fixLength(java.lang.String arg,
                                         int leng)
Converts a String argument to a specified length.

Returns:
modified argument

openSrcFile

public static java.io.BufferedReader openSrcFile(java.lang.String srcFileName)
                                          throws java.io.FileNotFoundException
Opens source file for input.

Returns:
BufferedReader
java.io.FileNotFoundException

openDstFile

public static java.io.PrintWriter openDstFile(java.lang.String dstFileName)
                                       throws java.io.FileNotFoundException
Opens/Creates destination file for output

Returns:
PrintWriter
java.io.FileNotFoundException