1 23 package org.archive.util.ms; 24 25 public class Piece { 26 27 private boolean unicode; 28 private int charPosStart; 29 private int charPosLimit; 30 private int filePos; 31 32 33 public Piece(int filePos, int start, int end, boolean unicode) { 34 this.filePos = filePos; 35 this.charPosStart = start; 36 this.charPosLimit = end; 37 this.unicode = unicode; 38 } 39 40 41 45 public int getFilePos() { 46 return filePos; 47 } 48 49 50 54 public int getCharPosLimit() { 55 return charPosLimit; 56 } 57 58 59 public int getCharPosStart() { 60 return charPosStart; 61 } 62 63 67 public boolean isUnicode() { 68 return unicode; 69 } 70 71 72 public String toString() { 73 StringBuilder sb = new StringBuilder (); 74 sb.append("Piece{filePos=").append(filePos); 75 sb.append(" start=").append(charPosStart); 76 sb.append(" end=").append(charPosLimit); 77 sb.append(" unicode=").append(unicode); 78 sb.append("}"); 79 return sb.toString(); 80 } 81 82 83 public boolean contains(int charPos) { 84 return (charPos >= charPosStart) && (charPos < charPosLimit); 85 } 86 } 87 | Popular Tags |