Codota Logo
SAXText
Code IndexAdd Codota to your IDE (free)

How to use
SAXText
in
org.milyn.delivery.sax

Best Java code snippets using org.milyn.delivery.sax.SAXText (Showing top 20 results out of 315)

  • Common ways to obtain SAXText
private void myMethod () {
SAXText s =
  • Codota Iconnew SAXText()
  • Smart code suggestions by Codota
}
origin: org.milyn/milyn-smooks-core

  /**
   * Clone this SAXText object.
   * @return A cloned copy of this SAXText object.
   */
  protected Object clone() {
    SAXText clone = new SAXText();

    clone.characters = new char[length];
    System.arraycopy(characters, offset, clone.characters, 0, length);
    clone.offset = 0;
    clone.length = length;
    clone.type = type;

    return clone;
  }
}
origin: org.milyn/milyn-smooks-core

  public boolean add(SAXText saxText) {
    if(textAccumulator != null) {
      // Clear the accumulatedText object so as any subsequent calls to the
      // getTextAsString method will recreate the buffer from scratch...
      accumulatedText = null;
    }
    return super.add((SAXText) saxText.clone());
  }
};
origin: smooks/smooks

public static void writeText(SAXText text, Writer writer) throws IOException {
  if(writer != null) {
    switch (text.getType()) {
      case TEXT:
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        break;
      case CDATA:
        writer.write("<![CDATA[");
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        writer.write("]]>");
        break;
      case COMMENT:
        writer.write("<!--");
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        writer.write("-->");
        break;
      case ENTITY:
        writer.write("&");
        writer.write(HTMLEntityLookup.getEntityRef(text.getCharacters()[text.getOffset()]));
        writer.write(';');
        break;
    }
  }
}
origin: org.milyn/milyn-smooks-all

/**
 * Write the text to the supplied writer.
 * <p/>
 * It wraps the text based on its {@link #getType() type}.
 *
 * @param writer The writer.
 * @throws IOException Write exception.
 */
public void toWriter(Writer writer) throws IOException {
  toWriter(writer, true);
}
origin: org.milyn/milyn-smooks-core

@SuppressWarnings("RedundantThrows")
public void onChildText(SAXElement element, SAXText childText, ExecutionContext executionContext) throws SmooksException, IOException {
  if(currentNode == document) {
    // Just ignore for now...
    return;
  }
  if(childText.getText().trim().length() == 0) {
    // Ignore pure whitespace...
    return;
  }
  switch (childText.getType()) {
    case TEXT:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
    case CDATA:
      currentNode.appendChild(document.createCDATASection(childText.getText()));
      break;
    case COMMENT:
      currentNode.appendChild(document.createComment(childText.getText()));
      break;
    case ENTITY:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
  }
}
origin: org.milyn/milyn-smooks-all

public SAXText(char[] characters, int offset, int length, TextType type) {
  setText(characters, offset, length, type);
}
origin: smooks/smooks

/**
 * Write the text to the supplied writer.
 * <p/>
 * It wraps the text based on its {@link #getType() type}.
 *
 * @param writer The writer.
 * @throws IOException Write exception.
 */
public void toWriter(Writer writer) throws IOException {
  toWriter(writer, true);
}
origin: smooks/smooks

@SuppressWarnings("RedundantThrows")
public void onChildText(SAXElement element, SAXText childText, ExecutionContext executionContext) throws SmooksException, IOException {
  if(currentNode == document) {
    // Just ignore for now...
    return;
  }
  if(childText.getText().trim().length() == 0) {
    // Ignore pure whitespace...
    return;
  }
  switch (childText.getType()) {
    case TEXT:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
    case CDATA:
      currentNode.appendChild(document.createCDATASection(childText.getText()));
      break;
    case COMMENT:
      currentNode.appendChild(document.createComment(childText.getText()));
      break;
    case ENTITY:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
  }
}
origin: org.virtuslab/milyn-smooks-core

public SAXText(char[] characters, int offset, int length, TextType type) {
  setText(characters, offset, length, type);
}
origin: org.milyn/milyn-smooks-all

public static void writeText(SAXText text, Writer writer) throws IOException {
  if(writer != null) {
    switch (text.getType()) {
      case TEXT:
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        break;
      case CDATA:
        writer.write("<![CDATA[");
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        writer.write("]]>");
        break;
      case COMMENT:
        writer.write("<!--");
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        writer.write("-->");
        break;
      case ENTITY:
        writer.write("&");
        writer.write(HTMLEntityLookup.getEntityRef(text.getCharacters()[text.getOffset()]));
        writer.write(';');
        break;
    }
  }
}
origin: org.virtuslab/milyn-smooks-core

/**
 * Write the text to the supplied writer.
 *
 * It wraps the text based on its {@link #getType() type}.
 *
 * @param writer The writer.
 * @throws IOException Write exception.
 */
public void toWriter(Writer writer) throws IOException {
  toWriter(writer, true);
}
origin: org.milyn/milyn-smooks-all

@SuppressWarnings("RedundantThrows")
public void onChildText(SAXElement element, SAXText childText, ExecutionContext executionContext) throws SmooksException, IOException {
  if(currentNode == document) {
    // Just ignore for now...
    return;
  }
  if(childText.getText().trim().length() == 0) {
    // Ignore pure whitespace...
    return;
  }
  switch (childText.getType()) {
    case TEXT:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
    case CDATA:
      currentNode.appendChild(document.createCDATASection(childText.getText()));
      break;
    case COMMENT:
      currentNode.appendChild(document.createComment(childText.getText()));
      break;
    case ENTITY:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
  }
}
origin: org.milyn/milyn-smooks-core

public SAXText(char[] characters, int offset, int length, TextType type) {
  setText(characters, offset, length, type);
}
origin: org.virtuslab/milyn-smooks-core

  /**
   * Clone this SAXText object.
   * @return A cloned copy of this SAXText object.
   */
  protected Object clone() {
    SAXText clone = new SAXText();

    clone.characters = new char[length];
    System.arraycopy(characters, offset, clone.characters, 0, length);
    clone.offset = 0;
    clone.length = length;
    clone.type = type;

    return clone;
  }
}
origin: smooks/smooks

  public boolean add(SAXText saxText) {
    if(textAccumulator != null) {
      // Clear the accumulatedText object so as any subsequent calls to the
      // getTextAsString method will recreate the buffer from scratch...
      accumulatedText = null;
    }
    return super.add((SAXText) saxText.clone());
  }
};
origin: org.milyn/milyn-smooks-core

public static void writeText(SAXText text, Writer writer) throws IOException {
  if(writer != null) {
    switch (text.getType()) {
      case TEXT:
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        break;
      case CDATA:
        writer.write("<![CDATA[");
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        writer.write("]]>");
        break;
      case COMMENT:
        writer.write("<!--");
        writer.write(text.getCharacters(), text.getOffset(), text.getLength());
        writer.write("-->");
        break;
      case ENTITY:
        writer.write("&");
        writer.write(HTMLEntityLookup.getEntityRef(text.getCharacters()[text.getOffset()]));
        writer.write(';');
        break;
    }
  }
}
origin: org.milyn/milyn-smooks-core

/**
 * Write the text to the supplied writer.
 * <p/>
 * It wraps the text based on its {@link #getType() type}.
 *
 * @param writer The writer.
 * @throws IOException Write exception.
 */
public void toWriter(Writer writer) throws IOException {
  toWriter(writer, true);
}
origin: org.virtuslab/milyn-smooks-core

public void onChildText(SAXElement element, SAXText childText, ExecutionContext executionContext) throws SmooksException, IOException {
  if(currentNode == document) {
    // Just ignore for now...
    return;
  }
  if(childText.getText().trim().length() == 0) {
    // Ignore pure whitespace...
    return;
  }
  switch (childText.getType()) {
    case TEXT:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
    case CDATA:
      currentNode.appendChild(document.createCDATASection(childText.getText()));
      break;
    case COMMENT:
      currentNode.appendChild(document.createComment(childText.getText()));
      break;
    case ENTITY:
      currentNode.appendChild(document.createTextNode(childText.getText()));
      break;
  }
}
origin: smooks/smooks

public SAXText(char[] characters, int offset, int length, TextType type) {
  setText(characters, offset, length, type);
}
origin: org.milyn/milyn-smooks-all

  /**
   * Clone this SAXText object.
   * @return A cloned copy of this SAXText object.
   */
  protected Object clone() {
    SAXText clone = new SAXText();

    clone.characters = new char[length];
    System.arraycopy(characters, offset, clone.characters, 0, length);
    clone.offset = 0;
    clone.length = length;
    clone.type = type;

    return clone;
  }
}
org.milyn.delivery.saxSAXText

Javadoc

SAX Text.

This class provides a wrapper around the char array supplied by the SAXParser/XMLReader. It help provide an optimization by allowing the process to avoid String construction where possible.

NOTE: References to instances of this type should not be cached. If you need to cache the character data housed in this class, you should use either the #getText() or #toString() methods.

Most used methods

  • <init>
  • clone
    Clone this SAXText object.
  • getCharacters
    Get the underlying character buffer.
  • getLength
    Get the character buffer length (in the #getCharacters()) of the text a associated with this SAXText
  • getOffset
    Get the character offset (in the #getCharacters()) of the text a associated with this SAXText instan
  • getText
    Get the raw text, unwrapped. This method differs from the #toString() implementation because it does
  • getType
    Get the text type (comment, cdata etc).
  • setText
  • toWriter
    Write the text to the supplied writer. It wraps the text based on its #getType().

Popular in Java

  • Reactive rest calls using spring rest template
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • String (java.lang)
  • JList (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now