org.crosswire.jsword.examples

## Class APIExamples

- java.lang.Object
- - org.crosswire.jsword.examples.APIExamples

-     public class APIExamples
      extends Object

  All the methods in this class highlight some are of the API and how to use it.
  Author:
    Joe Walker
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `APIExamples.MyBookFilter` A simple BookFilter that looks for a Bible by name.
    `(package private) static class` | `APIExamples.MyBooksListener` A simple BooksListener that actually does nothing.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static String` | `BIBLE_NAME` The name of a Bible to find

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `APIExamples()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Book` | `getBook(String bookInitials)` Get a particular installed book by initials.
    `SAXEventProvider` | `getOSIS(String bookInitials, String reference, int maxKeyCount)` Obtain a SAX event provider for the OSIS document representation of one or more book entries.
    `String` | `getPlainText(String bookInitials, String reference)` Get just the canonical text of one or more book entries without any markup.
    `void` | `installBook()`
    `static void` | `main(String[] args)` Quick Demo
    `void` | `pickBible()` This is an example of the different ways to select a Book from the selection available.
    `(package private) void` | `rankedSearch()` An example of how to perform a ranked search.
    `void` | `readDictionary()` While Bible and Commentary are very similar, a Dictionary is read in a slightly different way.
    `String` | `readStyledText(String bookInitials, String reference, int maxKeyCount)` Obtain styled text (in this case HTML) for a book reference.
    `void` | `search()` An example of how to search for various bits of data.
    `(package private) void` | `searchAndShow()` An example of how to do a search and then get text for each range of verses.

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

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

- - ### Field Detail

    - #### BIBLE_NAME

          private static final String BIBLE_NAME

      The name of a Bible to find
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### APIExamples

          public APIExamples()

  - ### Method Detail

    - #### getBook

          public Book getBook(String bookInitials)

      Get a particular installed book by initials.
      Parameters:
        `bookInitials` - The book name to search for
      Returns:
        The found book. Null otherwise.

    - #### getPlainText

          public String getPlainText(String bookInitials,
                            String reference)
                              throws BookException,
                                     NoSuchKeyException

      Get just the canonical text of one or more book entries without any markup.
      Parameters:
        `bookInitials` - the book to use
        `reference` - a reference, appropriate for the book, of one or more entries
      Returns:
        the plain text for the reference
      Throws:
        `BookException`
        `NoSuchKeyException`

    - #### getOSIS

          public SAXEventProvider getOSIS(String bookInitials,
                                 String reference,
                                 int maxKeyCount)
                                   throws BookException,
                                          NoSuchKeyException

      Obtain a SAX event provider for the OSIS document representation of one or more book entries.
      Parameters:
        `bookInitials` - the book to use
        `reference` - a reference, appropriate for the book, of one or more entries
        `maxKeyCount` -
      Returns:
        a SAX Event Provider to retrieve the reference
      Throws:
        `BookException`
        `NoSuchKeyException`

    - #### readStyledText

          public String readStyledText(String bookInitials,
                              String reference,
                              int maxKeyCount)
                                throws NoSuchKeyException,
                                       BookException,
                                       TransformerException,
                                       SAXException

      Obtain styled text (in this case HTML) for a book reference.
      Parameters:
        `bookInitials` - the book to use
        `reference` - a reference, appropriate for the book, of one or more entries
        `maxKeyCount` -
      Returns:
        the styled text
      Throws:
        `NoSuchKeyException`
        `BookException`
        `TransformerException`
        `SAXException`
      See Also:
        `Book`, `SAXEventProvider`

    - #### readDictionary

          public void readDictionary()
                              throws BookException

      While Bible and Commentary are very similar, a Dictionary is read in a slightly different way. It is also worth looking at the JavaDoc for Book that has a way of treating Bible, Commentary and Dictionary the same.
      Throws:
        `BookException`
      See Also:
        `Book`

    - #### search

          public void search()
                      throws BookException

      An example of how to search for various bits of data.
      Throws:
        `BookException`

    - #### rankedSearch

          void rankedSearch()
                      throws BookException

      An example of how to perform a ranked search.
      Throws:
        `BookException`

    - #### searchAndShow

          void searchAndShow()
                       throws BookException,
                              SAXException

      An example of how to do a search and then get text for each range of verses.
      Throws:
        `BookException`
        `SAXException`

    - #### pickBible

          public void pickBible()

      This is an example of the different ways to select a Book from the selection available.
      See Also:
        `Config`, `Books`

    - #### installBook

          public void installBook()

    - #### main

          public static void main(String[] args)
                           throws BookException,
                                  NoSuchKeyException,
                                  TransformerException,
                                  SAXException

      Quick Demo
      Parameters:
        `args` -
      Throws:
        `NoSuchKeyException`
        `BookException`
        `SAXException`
        `TransformerException`