/** * @param start Beginning offset in main document stream, in characters. * @param end Ending offset in main document stream, in characters. * @param text The raw bytes of our text */ public TextPiece(int start, int end, byte[] text, PieceDescriptor pd) { super(start, end, buildInitSB(text, pd)); _usesUnicode = pd.isUnicode(); _pd = pd; // Validate int textLength = ((CharSequence) _buf).length(); if (end - start != textLength) { throw new IllegalStateException("Told we're for characters " + start + " -> " + end + ", but actually covers " + textLength + " characters!"); } if (end < start) { throw new IllegalStateException("Told we're of negative size! start=" + start + " end=" + end); } }
/** * @param start * Beginning offset in main document stream, in characters. * @param end * Ending offset in main document stream, in characters. * @param text * The raw bytes of our text */ public TextPiece( int start, int end, byte[] text, PieceDescriptor pd ) { super(start, end, buildInitSB(text, pd)); _usesUnicode = pd.isUnicode(); _pd = pd; // Validate int textLength = ((CharSequence)_buf).length(); if(end-start != textLength) { throw new IllegalStateException("Told we're for characters " + start + " -> " + end + ", but actually covers " + textLength + " characters!"); } if(end < start) { throw new IllegalStateException("Told we're of negative size! start="+start + " end="+end); } }