Class RSSService

java.lang.Object
com.codename1.io.ConnectionRequest
com.codename1.io.services.RSSService
All Implemented Interfaces:
IOProgressListener, ParserCallback

public class RSSService extends ConnectionRequest implements ParserCallback
Simple RSS read and parse request, to handle errors just subclass this and override parsingError.
  • Constructor Details

    • RSSService

      public RSSService(String url)

      Simple constructor accepting the RSS url

      Parameters
      • url: rss link
    • RSSService

      public RSSService(String url, int limit)

      Simple constructor accepting the RSS url

      Parameters
      • url: rss link

      • limit: the limit on the number of RSS entries supported

    • RSSService

      public RSSService(String url, int limit, int startOffset)

      Simple constructor accepting the RSS url

      Parameters
      • url: rss link

      • limit: the limit on the number of RSS entries supported

      • startOffset: @param startOffset indicates the entry offset which we are interested in, this is useful if previously the limit for RSS entries was reached.

  • Method Details

    • equals

      public boolean equals(Object o)
      Description copied from class: ConnectionRequest
      Overrides:
      equals in class ConnectionRequest
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ConnectionRequest
    • readResponse

      protected void readResponse(InputStream input) throws IOException

      Callback for the server response with the input stream from the server. This method is invoked on the network thread

      Parameters
      • input: the input stream containing the response
      Throws
      • IOException: when a read input occurs
      Overrides:
      readResponse in class ConnectionRequest
      Throws:
      IOException
    • getResults

      public Vector getResults()

      The results are presented as a vector of hashtables easily presentable in Codename One

      Returns

      vector of hashtables

    • parsingError

      public boolean parsingError(int errorId, String tag, String attribute, String value, String description)

      Called when encountering an error while parsing the XML document. When implementing this, the developer should return true if the error should be ignored and the document needs to be further parsed, or false to stop parsing and issue an error to the user Note that this method is always called NOT on the EDT thread.

      Parameters
      • errorId: The error ID, one of the ERROR_* constants

      • tag: The tag in which the error occured (Can be null for non-tag related errors)

      • attribute: The attribute in which the error occured (Can be null for non-attribute related errors)

      • value: The value in which the error occured (Can be null for non-value related errors)

      • description: A verbal description of the error

      Returns

      true to continue parsing, false to stop

      Specified by:
      parsingError in interface ParserCallback
    • hasMore

      public boolean hasMore()

      Indicates whether more entries might be available since the limt might have been reached

      Returns

      the hasMore

    • isCreatePlainTextDetails

      public boolean isCreatePlainTextDetails()

      Creates an additional "details" attribute in the resulting hashtables which effectively contains a plain text version of the description tag.

      Returns

      the createPlainTextDetails

    • setCreatePlainTextDetails

      public void setCreatePlainTextDetails(boolean createPlainTextDetails)

      Creates an additional "details" attribute in the resulting hashtables which effectively contains a plain text version of the description tag.

      Parameters
      • createPlainTextDetails: the createPlainTextDetails to set
    • getIconPlaceholder

      public Image getIconPlaceholder()
      Returns

      the iconPlaceholder

    • setIconPlaceholder

      public void setIconPlaceholder(Image iconPlaceholder)
      Parameters
      • iconPlaceholder: the iconPlaceholder to set