Class NamingUtils


  • public class NamingUtils
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean debug
      Debug flag which must be true for debug streams to be created and dprint output to be generated.
      static java.io.PrintStream debugStream
      The debug printstream.
      static java.io.PrintStream errStream
      The error printstream.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NamingUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void dprint​(java.lang.String msg)
      Prints the message to the debug stream if debugging is enabled.
      static void errprint​(java.lang.String msg)
      Prints the message to the error stream (System.err is default).
      (package private) static java.lang.String getDirectoryStructuredName​(NameComponent[] name)
      A utility method that takes Array of NameComponent and converts into a directory structured name in the format of /id1.kind1/id2.kind2..
      static void makeDebugStream​(java.io.File logFile)
      Create a debug print stream to the supplied log file.
      static void makeErrStream​(java.io.File errFile)
      Create a error print stream to the supplied file.
      static void printException​(java.lang.Exception e)
      Prints the stacktrace of the supplied exception to the error stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • debug

        public static boolean debug
        Debug flag which must be true for debug streams to be created and dprint output to be generated.
      • debugStream

        public static java.io.PrintStream debugStream
        The debug printstream.
      • errStream

        public static java.io.PrintStream errStream
        The error printstream.
    • Constructor Detail

      • NamingUtils

        private NamingUtils()
    • Method Detail

      • dprint

        public static void dprint​(java.lang.String msg)
        Prints the message to the debug stream if debugging is enabled.
        Parameters:
        msg - the debug message to print.
      • errprint

        public static void errprint​(java.lang.String msg)
        Prints the message to the error stream (System.err is default).
        Parameters:
        msg - the error message to print.
      • printException

        public static void printException​(java.lang.Exception e)
        Prints the stacktrace of the supplied exception to the error stream.
        Parameters:
        e - any Java exception.
      • makeDebugStream

        public static void makeDebugStream​(java.io.File logFile)
                                    throws java.io.IOException
        Create a debug print stream to the supplied log file.
        Parameters:
        logFile - the file to which debug output will go.
        Throws:
        java.io.IOException - thrown if the file cannot be opened for output.
      • makeErrStream

        public static void makeErrStream​(java.io.File errFile)
                                  throws java.io.IOException
        Create a error print stream to the supplied file.
        Parameters:
        errFile - the file to which error messages will go.
        Throws:
        java.io.IOException - thrown if the file cannot be opened for output.
      • getDirectoryStructuredName

        static java.lang.String getDirectoryStructuredName​(NameComponent[] name)
        A utility method that takes Array of NameComponent and converts into a directory structured name in the format of /id1.kind1/id2.kind2.. This is used mainly for Logging.