/** * Replace a region of bytes in this ByteList with bytes from the given array. * * @param targetOff offset of target region in this ByteList * @param targetLen length of target region in this ByteList * @param source bytes to use for replacement */ public void replace(int targetOff, int targetLen, byte[] source) { replace(targetOff, targetLen, source, 0, source.length); }
/** * Replace a region of bytes in this ByteList with bytes from the given array. * * @param targetOff offset of target region in this ByteList * @param targetLen length of target region in this ByteList * @param source bytes to use for replacement */ public void replace(int targetOff, int targetLen, byte[] source) { replace(targetOff, targetLen, source, 0, source.length); }
/** * Replace a region of bytes in this ByteList with bytes from the given array. * * @param targetOff offset of target region in this ByteList * @param targetLen length of target region in this ByteList * @param source bytes to use for replacement */ public void replace(int targetOff, int targetLen, byte[] source) { replace(targetOff, targetLen, source, 0, source.length); }
/** * Replace all bytes in this ByteList with bytes from the given array. * * @param source bytes to use for replacement */ public void replace(byte[] source) { replace(0, realSize, source, 0, source.length); }
/** * Replace a region of bytes in this ByteList with bytes from the given ByteList. * * @param targetOff offset of target region in this ByteList * @param targetLen length of target region in this ByteList * @param source ByteList to use for replacement */ public void replace(int targetOff, int targetLen, ByteList source) { replace(targetOff, targetLen, source.bytes, source.begin, source.realSize); }
/** * Replace all bytes in this ByteList with bytes from the given array. * * @param source bytes to use for replacement */ public void replace(byte[] source) { replace(0, realSize, source, 0, source.length); }
/** * Replace all bytes in this ByteList with bytes from the given array. * * @param source bytes to use for replacement */ public void replace(byte[] source) { replace(0, realSize, source, 0, source.length); }
/** * Replace a region of bytes in this ByteList with bytes from the given ByteList. * * @param targetOff offset of target region in this ByteList * @param targetLen length of target region in this ByteList * @param source ByteList to use for replacement */ public void replace(int targetOff, int targetLen, ByteList source) { replace(targetOff, targetLen, source.bytes, source.begin, source.realSize); }
/** * Replace a region of bytes in this ByteList with bytes from the given ByteList. * * @param targetOff offset of target region in this ByteList * @param targetLen length of target region in this ByteList * @param source ByteList to use for replacement */ public void replace(int targetOff, int targetLen, ByteList source) { replace(targetOff, targetLen, source.bytes, source.begin, source.realSize); }
private final void view(byte[]bytes) { modifyCheck(); value.replace(bytes); shareLevel = SHARE_LEVEL_NONE; value.invalidate(); }
private void ungetbyteCommon(byte[] ungetBytes, int ungetBegin, int ungetLen) { final int start; // = ptr.pos; if (ungetLen == 0) return; StringIOData ptr = this.ptr; synchronized (ptr) { ptr.string.modify(); if (ungetLen > ptr.pos) { start = 0; } else { start = ptr.pos - ungetLen; } ByteList byteList = ptr.string.getByteList(); if (isEndOfString()) byteList.length(Math.max(ptr.pos, ungetLen)); byteList.replace(start, ptr.pos - start, ungetBytes, ungetBegin, ungetLen); ptr.pos = start; } }
private void ungetbyteCommon(byte[] ungetBytes, int ungetBegin, int ungetLen) { final int start; // = ptr.pos; if (ungetLen == 0) return; StringIOData ptr = this.ptr; synchronized (ptr) { ptr.string.modify(); if (ungetLen > ptr.pos) { start = 0; } else { start = ptr.pos - ungetLen; } ByteList byteList = ptr.string.getByteList(); if (isEndOfString()) byteList.length(Math.max(ptr.pos, ungetLen)); byteList.replace(start, ptr.pos - start, ungetBytes, ungetBegin, ungetLen); ptr.pos = start; } }
outBuffer.append(Arrays.copyOfRange(outBytes.array(), realOffset, outBytes.limit())); } else { outBuffer.replace(outOffset, outLimit - outOffset, Arrays.copyOfRange(outBytes.array(), realOffset, outBytes.limit()));
private void ungetbyteCommon(RubyString ungetBytes) { ByteList ungetByteList = ungetBytes.getByteList(); int len = ungetByteList.getRealSize(); int start = ptr.pos; if (len == 0) return; ptr.string.modify(); if (len > ptr.pos) { start = 0; } else { start = ptr.pos - len; } ByteList bytes = ptr.string.getByteList(); if (isEndOfString()) bytes.length(Math.max(ptr.pos, len)); bytes.replace(start, ptr.pos - start, ungetBytes.getByteList()); ptr.pos = start; }
private void ungetbyteCommon(RubyString ungetBytes) { ByteList ungetByteList = ungetBytes.getByteList(); int len = ungetByteList.getRealSize(); int start = ptr.pos; if (len == 0) return; ptr.string.modify(); if (len > ptr.pos) { start = 0; } else { start = ptr.pos - len; } ByteList bytes = ptr.string.getByteList(); if (isEndOfString()) bytes.length(Math.max(ptr.pos, len)); bytes.replace(start, ptr.pos - start, ungetBytes.getByteList()); ptr.pos = start; }
private void ungetbyteCommon(RubyString ungetBytes) { ByteList ungetByteList = ungetBytes.getByteList(); int len = ungetByteList.getRealSize(); int start = ptr.pos; if (len == 0) return; ptr.string.modify(); if (len > ptr.pos) { start = 0; } else { start = ptr.pos - len; } ByteList bytes = ptr.string.getByteList(); if (isEndOfString()) bytes.length(Math.max(ptr.pos, len)); bytes.replace(start, ptr.pos - start, ungetBytes.getByteList()); ptr.pos = start; }
private void ungetbyteCommon(RubyString ungetBytes) { ByteList ungetByteList = ungetBytes.getByteList(); int len = ungetByteList.getRealSize(); int start = ptr.pos; if (len == 0) return; ptr.string.modify(); if (len > ptr.pos) { start = 0; } else { start = ptr.pos - len; } ByteList bytes = ptr.string.getByteList(); if (isEndOfString()) bytes.length(Math.max(ptr.pos, len)); bytes.replace(start, ptr.pos - start, ungetBytes.getByteList()); ptr.pos = start; }
private int writeInternal18(ThreadContext context, IRubyObject arg) { checkWritable(); RubyString val = arg.asString(); ptr.string.modify(); if (ptr.modes.isAppendable()) { ptr.string.getByteList().append(val.getByteList()); ptr.pos = ptr.string.getByteList().length(); } else { int left = ptr.string.getByteList().length()-(int)ptr.pos; ptr.string.getByteList().replace((int)ptr.pos,Math.min(val.getByteList().length(),left),val.getByteList()); ptr.pos += val.getByteList().length(); } if (val.isTaint()) { ptr.string.setTaint(true); } return val.getByteList().length(); }
private int writeInternal18(ThreadContext context, IRubyObject arg) { checkWritable(); RubyString val = arg.asString(); ptr.string.modify(); if (ptr.modes.isAppendable()) { ptr.string.getByteList().append(val.getByteList()); ptr.pos = ptr.string.getByteList().length(); } else { int left = ptr.string.getByteList().length()-(int)ptr.pos; ptr.string.getByteList().replace((int)ptr.pos,Math.min(val.getByteList().length(),left),val.getByteList()); ptr.pos += val.getByteList().length(); } if (val.isTaint()) { ptr.string.setTaint(true); } return val.getByteList().length(); }
private int writeInternal(ThreadContext context, IRubyObject arg) { checkWritable(); checkFrozen(); RubyString val = arg.asString(); internal.modify(); if (modes.isAppendable()) { internal.getByteList().append(val.getByteList()); pos = internal.getByteList().length(); } else { int left = internal.getByteList().length()-(int)pos; internal.getByteList().replace((int)pos,Math.min(val.getByteList().length(),left),val.getByteList()); pos += val.getByteList().length(); } if (val.isTaint()) { internal.setTaint(true); } return val.getByteList().length(); }