1 21 package au.id.jericho.lib.html; 22 23 import java.io.*; 24 25 31 final class BlankOutputSegment implements OutputSegment { 32 private int begin; 33 private int end; 34 35 40 public BlankOutputSegment(final int begin, final int end) { 41 this.begin=begin; 42 this.end=end; 43 } 44 45 49 public BlankOutputSegment(final Segment segment) { 50 this(segment.getBegin(),segment.getEnd()); 51 } 52 53 public int getBegin() { 54 return begin; 55 } 56 57 public int getEnd() { 58 return end; 59 } 60 61 public void writeTo(final Writer writer) throws IOException { 62 for (int i=begin; i<end; i++) writer.write(' '); 63 } 64 65 public long getEstimatedMaximumOutputLength() { 66 return end-begin; 67 } 68 69 public String toString() { 70 StringBuffer sb=new StringBuffer (end-begin); 71 for (int i=begin; i<end; i++) sb.append(' '); 72 return sb.toString(); 73 } 74 75 public String getDebugInfo() { 76 return "("+begin+','+end+')'; 77 } 78 } 79 | Popular Tags |