/**
*
* Actually this is a byte range, which is used to hold the placeholder ranges * for later replacement. *
* * @author wprinz */ public class StringInfo implements Serializable { /** * SVUID. */ private static final long serialVersionUID = 5834801907046737048L; /** * The PDF document this range belongs to. */ protected byte[] pdf = null; /** * The start offset of the range. */ public int string_start = -1; /** * The length of the range. */ public int string_length = -1; /** * Copies the bytes of this range to a new byte array. * * @return Returns the new byte array. */ public byte[] copyStringBytes() { byte[] bytes = new byte[this.string_length]; System.arraycopy(this.pdf, this.string_start, bytes, 0, this.string_length); return bytes; } /** * Converts the range into a String. * * @return Returns the String. * @throws UnsupportedEncodingException * Forwarded exception. */ public String getString(String encoding) throws UnsupportedEncodingException { byte[] bytes = copyStringBytes(); return new String(bytes, encoding); } public String toString() { try { return "(" + this.string_start + "," + this.string_length + ")" + getString("ISO-8859-1"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return "(" + this.string_start + "," + this.string_length + ")"; } } }