@Test
 @Ignore
 public void testToFutureStream() throws Exception {
   assertThat(
       ToStream.toFutureStream(LazyStream.of(1, 2, 3, 4)).collect(Collectors.toList()).size(),
       is(4));
 }
  /**
   * Receive notification of character data.
   *
   * <p>The Parser will call this method to report each chunk of character data. SAX parsers may
   * return all contiguous character data in a single chunk, or they may split it into several
   * chunks; however, all of the characters in any single event must come from the same external
   * entity, so that the Locator provides useful information.
   *
   * <p>The application must not attempt to read from the array outside of the specified range.
   *
   * <p>Note that some parsers will report whitespace using the ignorableWhitespace() method rather
   * than this one (validating parsers must do so).
   *
   * @param ch The characters from the XML document.
   * @param start The start position in the array.
   * @param length The number of characters to read from the array.
   * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
   * @see #ignorableWhitespace
   * @see org.xml.sax.Locator
   */
  public void characters(char ch[], int start, int length) throws org.xml.sax.SAXException {

    flushPending();

    try {
      if (inTemporaryOutputState()) {
        /* leave characters un-processed as we are
         * creating temporary output, the output generated by
         * this serializer will be input to a final serializer
         * later on and it will do the processing in final
         * output state (not temporary output state).
         *
         * A "temporary" ToTextStream serializer is used to
         * evaluate attribute value templates (for example),
         * and the result of evaluating such a thing
         * is fed into a final serializer later on.
         */
        m_writer.write(ch, start, length);
      } else {
        // In final output state we do process the characters!
        writeNormalizedChars(ch, start, length, m_lineSepUse);
      }

      if (m_tracer != null) super.fireCharEvent(ch, start, length);
    } catch (IOException ioe) {
      throw new SAXException(ioe);
    }
  }
  /**
   * Receive notification of the beginning of a document.
   *
   * <p>The SAX parser will invoke this method only once, before any other methods in this interface
   * or in DTDHandler (except for setDocumentLocator).
   *
   * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
   * @throws org.xml.sax.SAXException
   */
  protected void startDocumentInternal() throws org.xml.sax.SAXException {
    super.startDocumentInternal();

    m_needToCallStartDocument = false;

    // No action for the moment.
  }
Exemple #4
0
 @Test
 public void testToJooqLambda() throws Exception {
   assertThat(
       ToStream.toJooqLambda(FluentIterable.of(new Integer[] {1, 2, 3, 4}))
           .collect(Collectors.toList())
           .size(),
       is(4));
 }
 /**
  * Receive notification of cdata.
  *
  * <p>The Parser will call this method to report each chunk of character data. SAX parsers may
  * return all contiguous character data in a single chunk, or they may split it into several
  * chunks; however, all of the characters in any single event must come from the same external
  * entity, so that the Locator provides useful information.
  *
  * <p>The application must not attempt to read from the array outside of the specified range.
  *
  * <p>Note that some parsers will report whitespace using the ignorableWhitespace() method rather
  * than this one (validating parsers must do so).
  *
  * @param ch The characters from the XML document.
  * @param start The start position in the array.
  * @param length The number of characters to read from the array.
  * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
  * @see #ignorableWhitespace
  * @see org.xml.sax.Locator
  */
 public void cdata(char ch[], int start, int length) throws org.xml.sax.SAXException {
   try {
     writeNormalizedChars(ch, start, length, m_lineSepUse);
     if (m_tracer != null) super.fireCDATAEvent(ch, start, length);
   } catch (IOException ioe) {
     throw new SAXException(ioe);
   }
 }
Exemple #6
0
 @Test
 @Ignore
 public void testToFutureStream() throws Exception {
   assertThat(
       ToStream.toFutureStream(FluentIterable.of(new Integer[] {1, 2, 3, 4}))
           .collect(Collectors.toList())
           .size(),
       is(4));
 }
 /**
  * Receive notification of the beginning of an element.
  *
  * <p>The Parser will invoke this method at the beginning of every element in the XML document;
  * there will be a corresponding endElement() event for every startElement() event (even when the
  * element is empty). All of the element's content will be reported, in order, before the
  * corresponding endElement() event.
  *
  * <p>If the element name has a namespace prefix, the prefix will still be attached. Note that the
  * attribute list provided will contain only attributes with explicit values (specified or
  * defaulted): #IMPLIED attributes will be omitted.
  *
  * @param namespaceURI The Namespace URI, or the empty string if the element has no Namespace URI
  *     or if Namespace processing is not being performed.
  * @param localName The local name (without prefix), or the empty string if Namespace processing
  *     is not being performed.
  * @param name The qualified name (with prefix), or the empty string if qualified names are not
  *     available.
  * @param atts The attributes attached to the element, if any.
  * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
  * @see #endElement
  * @see org.xml.sax.AttributeList
  * @throws org.xml.sax.SAXException
  */
 public void startElement(String namespaceURI, String localName, String name, Attributes atts)
     throws org.xml.sax.SAXException {
   // time to fire off startElement event
   if (m_tracer != null) {
     super.fireStartElem(name);
     this.firePseudoAttributes();
   }
   return;
 }
  /** From XSLTC */
  public void startElement(String elementNamespaceURI, String elementLocalName, String elementName)
      throws SAXException {
    if (m_needToCallStartDocument) startDocumentInternal();
    // time to fire off startlement event.
    if (m_tracer != null) {
      super.fireStartElem(elementName);
      this.firePseudoAttributes();
    }

    return;
  }
 /** @see ExtendedContentHandler#endElement(String) */
 public void endElement(String elemName) throws SAXException {
   if (m_tracer != null) super.fireEndElem(elemName);
 }
 /**
  * Receive notification of the end of an element.
  *
  * <p>The SAX parser will invoke this method at the end of every element in the XML document;
  * there will be a corresponding startElement() event for every endElement() event (even when the
  * element is empty).
  *
  * <p>If the element name has a namespace prefix, the prefix will still be attached to the name.
  *
  * @param namespaceURI The Namespace URI, or the empty string if the element has no Namespace URI
  *     or if Namespace processing is not being performed.
  * @param localName The local name (without prefix), or the empty string if Namespace processing
  *     is not being performed.
  * @param name The qualified name (with prefix), or the empty string if qualified names are not
  *     available.
  * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
  * @throws org.xml.sax.SAXException
  */
 public void endElement(String namespaceURI, String localName, String name)
     throws org.xml.sax.SAXException {
   if (m_tracer != null) super.fireEndElem(name);
 }
  /**
   * Report an XML comment anywhere in the document.
   *
   * <p>This callback will be used for comments inside or outside the document element, including
   * comments in the external DTD subset (if read).
   *
   * @param ch An array holding the characters in the comment.
   * @param start The starting position in the array.
   * @param length The number of characters to use from the array.
   * @throws org.xml.sax.SAXException The application may raise an exception.
   */
  public void comment(char ch[], int start, int length) throws org.xml.sax.SAXException {

    flushPending();
    if (m_tracer != null) super.fireCommentEvent(ch, start, length);
  }
 /**
  * Receive notivication of a entityReference.
  *
  * @param name non-null reference to the name of the entity.
  * @throws org.xml.sax.SAXException
  */
 public void entityReference(String name) throws org.xml.sax.SAXException {
   if (m_tracer != null) super.fireEntityReference(name);
 }
  /**
   * Receive notification of a processing instruction.
   *
   * <p>The Parser will invoke this method once for each processing instruction found: note that
   * processing instructions may occur before or after the main document element.
   *
   * <p>A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text
   * declaration (XML 1.0, section 4.3.1) using this method.
   *
   * @param target The processing instruction target.
   * @param data The processing instruction data, or null if none was supplied.
   * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
   * @throws org.xml.sax.SAXException
   */
  public void processingInstruction(String target, String data) throws org.xml.sax.SAXException {
    // flush anything pending first
    flushPending();

    if (m_tracer != null) super.fireEscapingEvent(target, data);
  }
Exemple #14
0
 @Test
 public void testToLazySeq() throws Exception {
   assertThat(
       ToStream.toLazySeq(FluentIterable.of(new Integer[] {1, 2, 3, 4})).toList().size(), is(4));
 }
 @Test
 public void testToJooqLambda() throws Exception {
   assertThat(
       ToStream.toJooqLambda(LazyStream.of(1, 2, 3, 4)).collect(Collectors.toList()).size(),
       is(4));
 }
 @Test
 public void testToLazySeq() throws Exception {
   assertThat(ToStream.toLazySeq(LazyStream.of(1, 2, 3, 4)).toList().size(), is(4));
 }
 @Test
 public void testToFunctionalJavaStream() throws Exception {
   assertThat(ToStream.toFunctionalJavaStream(LazyStream.of(1, 2, 3, 4)).toList().length(), is(4));
 }
 /**
  * Receive notification of the end of a document.
  *
  * <p>The SAX parser will invoke this method only once, and it will be the last method invoked
  * during the parse. The parser shall not invoke this method until it has either abandoned parsing
  * (because of an unrecoverable error) or reached the end of input.
  *
  * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
  * @throws org.xml.sax.SAXException
  */
 public void endDocument() throws org.xml.sax.SAXException {
   flushPending();
   flushWriter();
   if (m_tracer != null) super.fireEndDoc();
 }
Exemple #19
0
 @Test
 public void testToFJStream() throws Exception {
   assertThat(
       ToStream.toFJStream(FluentIterable.of(new Integer[] {1, 2, 3, 4})).toList().length(),
       is(4));
 }