Class AsciiReadSupport

java.lang.Object
cnuphys.lund.AsciiReadSupport

public class AsciiReadSupport extends Object
Support for simpe ASCII reads
Author:
heddle
  • Field Details Link icon

  • Constructor Details Link icon

    • AsciiReadSupport Link icon

      public AsciiReadSupport()
  • Method Details Link icon

    • nextNonComment Link icon

      public static String nextNonComment(BufferedReader bufferedReader)
      Get the next non comment line
      Parameters:
      bufferedReader - a buffered reader which should be linked to an ascii file
      Returns:
      the next non comment line (or null)
    • countNonCommentLines Link icon

      public static int countNonCommentLines(File file)
      Counts the number of non-comment lines in a file
      Parameters:
      file - the file in question
      Returns:
      the number of non-comment lines in the file
    • asciiFileToString Link icon

      public static String asciiFileToString(File file)
      Read an entire ascii file into a single string.
      Parameters:
      file - the file to read
      Returns:
      the string with the entire content of the file
    • countLines Link icon

      public static int countLines(File file)
      Count the lines in an ASCII file, without skipping comment
      Parameters:
      file - the file in question
      Returns:
      the number of lines in the file
    • nextTokens Link icon

      public static String[] nextTokens(BufferedReader bufferedReader)
      Get the next tokens from a buffered reader
      Parameters:
      bufferedReader - a buffered reader which should be linked to an ascii file
      Returns:
      the next set of white-space separated tokens.
    • tokens Link icon

      public static String[] tokens(String str, String delimiter)
      This method breaks a string into an array of tokens.
      Parameters:
      str - the string to decompose.
      delimiter - the delimiter
      Returns:
      an array of tokens
    • tokens Link icon

      public static String[] tokens(String str)
      This method breaks a string into an array of tokens.
      Parameters:
      str - the string to decompose.
      Returns:
      an array of tokens
    • skipLines Link icon

      public static void skipLines(int n, BufferedReader bufferedReader)
      Skip lines in an ascii file
      Parameters:
      n - the number of lines to skip
      bufferedReader - a buffered reader which should be linked to an ascii file