Class SnippetReader


  • public class SnippetReader
    extends java.lang.Object
    Utility class for reading snippets.
    • Constructor Summary

      Constructors 
      Constructor Description
      SnippetReader​(java.net.URL src)
      Constructor.
      SnippetReader​(java.net.URL src, java.lang.String encoding)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static boolean isDemarcator​(java.lang.String snippetId, java.lang.String what, java.lang.String line)
      Determines if the given line is a demarcator.
      protected boolean isEnd​(java.lang.String snippetId, java.lang.String line)
      Determines if the given line is an end demarcator.
      protected boolean isStart​(java.lang.String snippetId, java.lang.String line)
      Determines if the given line is a start demarcator.
      java.lang.StringBuffer readSnippet​(java.lang.String snippetId)
      Reads the snippet with given id.
      • Methods inherited from class java.lang.Object

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

      • SnippetReader

        public SnippetReader​(java.net.URL src,
                             java.lang.String encoding)
        Constructor.
        Parameters:
        src - The source
        encoding - The file encoding
      • SnippetReader

        public SnippetReader​(java.net.URL src)
        Constructor.
        Parameters:
        src - The source
    • Method Detail

      • readSnippet

        public java.lang.StringBuffer readSnippet​(java.lang.String snippetId)
                                           throws java.io.IOException
        Reads the snippet with given id.
        Parameters:
        snippetId - The id of the snippet.
        Returns:
        The snippet.
        Throws:
        java.io.IOException - if something goes wrong.
      • isStart

        protected boolean isStart​(java.lang.String snippetId,
                                  java.lang.String line)
        Determines if the given line is a start demarcator.
        Parameters:
        snippetId - the id of the snippet.
        line - the line.
        Returns:
        True, if the line is a start demarcator.
      • isDemarcator

        protected static boolean isDemarcator​(java.lang.String snippetId,
                                              java.lang.String what,
                                              java.lang.String line)
        Determines if the given line is a demarcator.
        Parameters:
        snippetId - the id of the snippet.
        what - Identifier for the demarcator.
        line - the line.
        Returns:
        True, if the line is a start demarcator.
      • isEnd

        protected boolean isEnd​(java.lang.String snippetId,
                                java.lang.String line)
        Determines if the given line is an end demarcator.
        Parameters:
        snippetId - the id of the snippet.
        line - the line.
        Returns:
        True, if the line is an end demarcator.