1 21 package au.id.jericho.lib.html; 22 23 import java.io.*; 24 25 31 final class CharOutputSegment implements OutputSegment { 32 private int begin; 33 private int end; 34 private char ch; 35 36 42 public CharOutputSegment(final int begin, final int end, final char ch) { 43 this.begin=begin; 44 this.end=end; 45 this.ch=ch; 46 } 47 48 53 public CharOutputSegment(final Segment segment, final char ch) { 54 begin=segment.begin; 55 end=segment.end; 56 this.ch=ch; 57 } 58 59 63 public CharOutputSegment(final CharacterReference characterReference) { 64 this(characterReference,characterReference.getChar()); 65 } 66 67 public int getBegin() { 68 return begin; 69 } 70 71 public int getEnd() { 72 return end; 73 } 74 75 public void writeTo(final Writer writer) throws IOException { 76 writer.write(ch); 77 } 78 79 public long getEstimatedMaximumOutputLength() { 80 return 1; 81 } 82 83 public String toString() { 84 return Character.toString(ch); 85 } 86 87 public String getDebugInfo() { 88 return "("+begin+','+end+"):"+ch; 89 } 90 } 91 | Popular Tags |