Package org.svetovid

Class Svetovid


  • public final class Svetovid
    extends java.lang.Object
    This is a utility class that serves as an easy access point to various functionalities of Svetovid library. The main functionalities provided are readers and writers for standard input and output streams and file access, as well as graphical user interface message boxes and dialogs.
    Author:
    Ivan Pribela
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean AUTO_FLUSH
      By default, all writers will not flush automatically.
      static java.lang.String CHARSET_NAME
      Default encoding is Unicode UTF-8.
      static StandardSvetovidErrorWriter err
      The "standard" error output.
      static AutoCloseDialogFactory gui
      The graphical user interface factory used to create and show message and dialog boxes.
      static StandardSvetovidReader in
      The "standard" input.
      static java.util.Locale LOCALE
      Default locale is US English.
      static java.lang.String NULL_STRING
      String that is used to substitute null value.
      static StandardSvetovidWriter out
      The "standard" output.
      static boolean THROW_EXCEPTIONS
      By default, all readers and writers are not throwing exceptions.
      static java.lang.String WHITESPACE
      Default token separator is a single space character.
      static java.util.regex.Pattern WHITESPACE_PATTERN
      Default pattern for matching whitespace is same as in Java programming language.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static SvetovidWriter append​(java.lang.String target)
      The output writer that will append data to the given target.
      static SvetovidReader close​(SvetovidReader reader)
      Closes the given reader and releases any resources associated with the underlying source.
      static SvetovidWriter close​(SvetovidWriter writer)
      Closes the given writer and releases any resources associated with the underlying target.
      static SvetovidReader closeIn​(java.lang.String source)
      Closes the reader (if any) and releases any resources associated with the given source.
      static SvetovidWriter closeOut​(java.lang.String target)
      Closes the writer (if any) and releases any resources associated with the given target.
      static java.util.List<Release> getLibraryReleases()  
      static Version getVersion()  
      static java.lang.String getVersionString()  
      static SvetovidReader in​(java.lang.String source)
      The input reader for the given source.
      static SvetovidWriter out​(java.lang.String target)
      The output writer for the given target.
      static SvetovidWriter out​(java.lang.String target, boolean append)
      The output writer that will optionally append data to the given target.
      static boolean testAppend​(java.lang.String target)
      Checks whether the data can be appended to the given target.
      static boolean testIn​(java.lang.String source)
      Checks whether the given source can be used for input.
      static boolean testOut​(java.lang.String target)
      Checks whether the given target can be used for output.
      static boolean testOut​(java.lang.String target, boolean append)
      Checks whether the given target can be used for output.
      • Methods inherited from class java.lang.Object

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

      • CHARSET_NAME

        public static final java.lang.String CHARSET_NAME
        Default encoding is Unicode UTF-8.
        See Also:
        Constant Field Values
      • LOCALE

        public static final java.util.Locale LOCALE
        Default locale is US English.
      • WHITESPACE_PATTERN

        public static final java.util.regex.Pattern WHITESPACE_PATTERN
        Default pattern for matching whitespace is same as in Java programming language.
      • WHITESPACE

        public static final java.lang.String WHITESPACE
        Default token separator is a single space character.
        See Also:
        Constant Field Values
      • NULL_STRING

        public static final java.lang.String NULL_STRING
        String that is used to substitute null value.
        See Also:
        Constant Field Values
      • AUTO_FLUSH

        public static final boolean AUTO_FLUSH
        By default, all writers will not flush automatically.
        See Also:
        Constant Field Values
      • THROW_EXCEPTIONS

        public static final boolean THROW_EXCEPTIONS
        By default, all readers and writers are not throwing exceptions.
        See Also:
        Constant Field Values
      • in

        public static StandardSvetovidReader in
        The "standard" input. This reader is already open and ready to supply input data. Typically this stream corresponds to keyboard input or another input source specified by the host environment or user.
      • out

        public static StandardSvetovidWriter out
        The "standard" output. This writer is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user.
      • err

        public static StandardSvetovidErrorWriter err
        The "standard" error output. This writer is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored.
      • gui

        public static final AutoCloseDialogFactory gui
        The graphical user interface factory used to create and show message and dialog boxes.
    • Method Detail

      • testIn

        public static boolean testIn​(java.lang.String source)
        Checks whether the given source can be used for input.
        Parameters:
        source - a string describing the source
        Returns:
        true if the given source can be read; false otherwise.
      • in

        public static SvetovidReader in​(java.lang.String source)
                                 throws SvetovidIOException
        The input reader for the given source. The returned reader is already open and ready to supply input data. If the supplied source string is a file name, the returned reader will correspond to that file. If the source is a URL the reader will read the resource identified by that URL. If the source is null, the returned reader will correspond to the standard input stream. Otherwise, an exception will be thrown.
        Parameters:
        source - a string describing the source
        Returns:
        a SvetovidReader that can be used to read from the desired source.
        Throws:
        SvetovidIOException - if the reader cannot be created for the given source or an error occurred during the operation.
      • closeIn

        public static SvetovidReader closeIn​(java.lang.String source)
                                      throws SvetovidIOException
        Closes the reader (if any) and releases any resources associated with the given source.
        Parameters:
        source - the source for which to close the reader
        Returns:
        the closed reader.
        Throws:
        SvetovidIOException - if an error occurred during the operation.
      • testOut

        public static boolean testOut​(java.lang.String target)
        Checks whether the given target can be used for output.
        Parameters:
        target - a string describing the target
        Returns:
        true if it is possible to write to the given target; false otherwise.
      • testAppend

        public static boolean testAppend​(java.lang.String target)
        Checks whether the data can be appended to the given target.
        Parameters:
        target - a string describing the target
        Returns:
        true if it is possible to append data to the given target; false otherwise.
      • testOut

        public static boolean testOut​(java.lang.String target,
                                      boolean append)
        Checks whether the given target can be used for output.
        Parameters:
        target - a string describing the target
        append - true to check if the data can be appended to the target; false to check if the data can be overwritten
        Returns:
        true if it is possible to write to the given target; false otherwise.
      • out

        public static SvetovidWriter out​(java.lang.String target)
        The output writer for the given target. The returned writer is already open and ready to accept output data. If the supplied target string is a file name, the returned writer will correspond to that file. If the target is null, the returned writer will correspond to the standard output stream. Otherwise, an exception will be thrown.
        Parameters:
        target - a string describing the writter's target
        Returns:
        a SvetovidWriter that can be used to write to the desired target.
      • append

        public static SvetovidWriter append​(java.lang.String target)
        The output writer that will append data to the given target. The returned writer is already open and ready to accept output data. If the supplied target string is a file name, the returned writer will correspond to that file. If the target is null, the returned writer will correspond to the standard output stream. Otherwise, an exception will be thrown.
        Parameters:
        target - a string describing the writter's target
        Returns:
        a SvetovidWriter that can be used to write to the desired target.
      • out

        public static SvetovidWriter out​(java.lang.String target,
                                         boolean append)
                                  throws SvetovidIOException
        The output writer that will optionally append data to the given target. The returned writer is already open and ready to accept output data. If the supplied target string is a file name, the returned writer will correspond to that file. If the target is null, the returned writer will correspond to the standard output stream. Otherwise, an exception will be thrown.
        Parameters:
        target - a string describing the writter's target
        append - should the data be appended to the given target or not
        Returns:
        a SvetovidWriter that can be used to write to the desired target.
        Throws:
        SvetovidIOException - if the writer cannot be created for the given target or an error occurred during the operation.
      • closeOut

        public static SvetovidWriter closeOut​(java.lang.String target)
                                       throws SvetovidIOException
        Closes the writer (if any) and releases any resources associated with the given target.
        Parameters:
        target - the target for which to close the writer
        Returns:
        the closed writer.
        Throws:
        SvetovidIOException - if an error occurred during the operation.
      • getVersionString

        public static java.lang.String getVersionString()
      • getVersion

        public static Version getVersion()
      • getLibraryReleases

        public static java.util.List<Release> getLibraryReleases()