org.bootchart.common

## Class Common

- java.lang.Object
- - org.bootchart.common.Common

-     public class Common
      extends java.lang.Object

  Common methods.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Common.LogFileFilter` File name filter for bootchart log files.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.Locale` | `LOCALE` Default locale.
    `static int` | `MAX_PARSE_SAMPLES` The maximum number of samples to parse.
    `static java.util.List` | `PROC_PARAM` A list of processes which should include parameters in their command lines.
    `static java.lang.String` | `VERSION` Program version.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Common()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `formatCommand(java.lang.String cmd)` Format the specified command line.
    `static java.lang.String` | `getProcessDesc(Process proc, java.util.Date startTime)` Returns the text to include in the process description pop-up.
    `static java.io.BufferedReader` | `getReader(java.io.InputStream is)` Returns a buffered reader suitable for reading the input stream.
    `static boolean` | `isPNGSupported()` Whether the running JVM supports PNG encoding.
    `static java.lang.String` | `loadFile(java.io.File file)` Loads the contents of the file.
    `static double` | `parseDouble(java.lang.String s)` Returns a new `double` initialized to the value represented by the specified `String`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### VERSION

          public static final java.lang.String VERSION

      Program version.
      See Also:
        Constant Field Values

    - #### LOCALE

          public static final java.util.Locale LOCALE

      Default locale.

    - #### PROC_PARAM

          public static final java.util.List PROC_PARAM

      A list of processes which should include parameters in their command lines.

    - #### MAX_PARSE_SAMPLES

          public static final int MAX_PARSE_SAMPLES

      The maximum number of samples to parse.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Common

          public Common()

  - ### Method Detail

    - #### loadFile

          public static java.lang.String loadFile(java.io.File file)
                                           throws java.io.IOException

      Loads the contents of the file. The file is either read from the file system or retrieved as resource stream.
      Parameters:
        `file` - the file to read
      Returns:
        file contents string
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### getReader

          public static java.io.BufferedReader getReader(java.io.InputStream is)
                                                  throws java.io.IOException

      Returns a buffered reader suitable for reading the input stream.
      Parameters:
        `is` - input stream to read
      Returns:
        buffered reader
      Throws:
        `java.io.IOException` - if an I/O error occurs

    - #### parseDouble

          public static double parseDouble(java.lang.String s)

      Returns a new `double` initialized to the value represented by the specified `String`. Any decimal commas in the string are replaced with dots.
      Parameters:
        `s` - the string to be parsed
      Returns:
        the double value represented by the string argument

    - #### formatCommand

          public static java.lang.String formatCommand(java.lang.String cmd)

      Format the specified command line. Shell invocations, paths and parameters are removed (e.g. "/bin/bash /etc/rc.d/rc.sysinit" -> "rc.sysinit"). Paramaters are included for certain commands (e.g. modprobe and rc).
      Parameters:
        `cmd` - command line
      Returns:
        a trimed command line

    - #### getProcessDesc

          public static java.lang.String getProcessDesc(Process proc,
                                                        java.util.Date startTime)

      Returns the text to include in the process description pop-up. The description includes the PID, command name, start time, duration and any user-specified description (e.g. script stack trace).
      Parameters:
        `proc` - the process to get description for
        `startTime` - process tree start time
      Returns:
        a multiline process description text

    - #### isPNGSupported

          public static boolean isPNGSupported()

      Whether the running JVM supports PNG encoding. Some runtime environments (e.g. those based on GNU Classpath) don't have the necessary Graphics2D support.
      Returns:
        whether this JVM supports PNG encoding