Example #1
0
  @Override
  protected void writeCharacters(final TextPosition aText) throws IOException {
    if (log.isTraceEnabled()) {
      log.trace("[" + aText.getCharacter() + "]");
    }

    if (regionText == null) {
      throw new IllegalStateException("No region started");
    }

    regionText.append(aText.getCharacter());
  }
 public List<Match> match(List<TextPosition> textPositions, final Pattern pattern) {
   StringBuilder sb = new StringBuilder(textPositions.size() * 2);
   for (TextPosition textPosition : textPositions) {
     if (textPosition != null) sb.append(textPosition.getCharacter());
   }
   return match(textPositions, sb.toString(), pattern);
 }
Example #3
0
 /**
  * A method provided as an event interface to allow a subclass to perform some specific
  * functionality when text needs to be processed
  *
  * @param text The text to be processed
  */
 protected void processTextPosition(TextPosition text) {
   System.out.println(
       "String["
           + text.getXDirAdj()
           + ","
           + text.getYDirAdj()
           + " fs="
           + text.getFontSize()
           + " xscale="
           + text.getXScale()
           + " height="
           + text.getHeightDir()
           + " space="
           + text.getWidthOfSpace()
           + " width="
           + text.getWidthDirAdj()
           + "]"
           + text.getCharacter());
 }
 /**
  * Write the string in TextPosition to the text cache.
  *
  * @param text The text to write to the stream.
  */
 @Override
 protected void writeCharacters(final TextPosition text) {
   final String character = text.getCharacter();
   textCache.append(character, text);
 }