private void insertBytesEnclosedAt(int offset, byte[] content, long l) throws ModifyException { if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } int contentOffset = (int)l; int contentLen = (int)(l>>32); if (contentOffset < 0 || contentLen <0 || contentOffset+contentLen > content.length){ throw new ModifyException("Invalid contentOffset and/or contentLen"); } flb.append( (long)offset | MASK_INSERT_SEGMENT_BYTE_ENCLOSED); ByteSegment bs = new ByteSegment(); bs.ba = content; bs.len = contentLen; bs.offset = contentOffset; fob.append(bs); }
private void insertBytesEnclosedAt(int offset, byte[] content, long l) throws ModifyException { if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } int contentOffset = (int)l; int contentLen = (int)(l>>32); if (contentOffset < 0 || contentLen <0 || contentOffset+contentLen > content.length){ throw new ModifyException("Invalid contentOffset and/or contentLen"); } flb.append( (long)offset | MASK_INSERT_SEGMENT_BYTE_ENCLOSED); ByteSegment bs = new ByteSegment(); bs.ba = content; bs.len = contentLen; bs.offset = contentOffset; fob.append(bs); }
private void insertBytesEnclosedAt(int offset, byte[] content, long l) throws ModifyException { if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } int contentOffset = (int)l; int contentLen = (int)(l>>32); if (contentOffset < 0 || contentLen <0 || contentOffset+contentLen > content.length){ throw new ModifyException("Invalid contentOffset and/or contentLen"); } flb.append( (long)offset | MASK_INSERT_SEGMENT_BYTE_ENCLOSED); ByteSegment bs = new ByteSegment(); bs.ba = content; bs.len = contentLen; bs.offset = contentOffset; fob.append(bs); }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); fob.append(ef); }
/** * Insert ns compensated element fragment into the document * @param ef * */ private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); fob.append(ef); }
/** * insert the byte content into XML * @param offset (in char, not byte) * @param content * */ public void insertBytesAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE); fob.append(content); }
/** * insert the byte content into XML * @param offset (in char, not byte) * @param content * */ public void insertBytesAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE); fob.append(content); }
/** * insert the byte content into XML and surround it with "<" and ">" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }
/** * insert the byte content into XML and surround it with ">" and "<" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }
/** * insert the byte content into XML and surround it with ">" and "<" * @param offset (in char, not byte) * @param content * */ private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); fob.append(content); }
/** * insert the byte content into XML * @param offset (in char, not byte) * @param content * */ public void insertBytesAt(int offset, byte[] content) throws ModifyException{ if (insertHash.isUnique(offset)==false){ throw new ModifyException("There can be only one insert per offset"); } flb.append( (long)offset | MASK_INSERT_BYTE); fob.append(content); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte value of s after the element * @param s the string whose byte content will be inserted into the master document * */ public void insertAfterElement(String s) throws ModifyException,UnsupportedEncodingException,NavException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int)l; int len = (int)(l>>32); insertBytesAt(offset+len,s.getBytes(charSet)); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte value of s after the element * @param s the string whose byte content will be inserted into the master document * */ public void insertAfterElement(String s) throws ModifyException,UnsupportedEncodingException,NavException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int)l; int len = (int)(l>>32); insertBytesAt(offset+len,s.getBytes(charSet)); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte value of s before the element * @param s * */ public void insertBeforeElement(String s) throws ModifyException,UnsupportedEncodingException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); int offset = md.getTokenOffset(startTagIndex)-1; if (encoding < VTDNav.FORMAT_UTF_16BE) insertBytesAt(offset,s.getBytes(charSet)); else insertBytesAt((offset)<<1,s.getBytes(charSet)); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte value of s after the element * @param s the string whose byte content will be inserted into the master document * */ public void insertAfterElement(String s) throws ModifyException,UnsupportedEncodingException,NavException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); long l = md.getElementFragment(); int offset = (int)l; int len = (int)(l>>32); insertBytesAt(offset+len,s.getBytes(charSet)); }
/** * This method will first call getCurrentIndex() to get the cursor index value * then insert the byte value of s before the element * @param s * */ public void insertBeforeElement(String s) throws ModifyException,UnsupportedEncodingException{ int startTagIndex =md.getCurrentIndex(); int type = md.getTokenType(startTagIndex); if (type!=VTDNav.TOKEN_STARTING_TAG) throw new ModifyException("Token type is not a starting tag"); int offset = md.getTokenOffset(startTagIndex)-1; if (encoding < VTDNav.FORMAT_UTF_16BE) insertBytesAt(offset,s.getBytes(charSet)); else insertBytesAt((offset)<<1,s.getBytes(charSet)); }