private getChars ( int par0, int par1, char par2, int par3 ) : void | ||
par0 | int | |
par1 | int | |
par2 | char | |
par3 | int | |
Résultat | void |
public virtual AbstractStringBuilder replace(int start, int end, String str) { if (start < 0) { throw new IndexOutOfRangeException(); } if (start > count) { throw new IndexOutOfRangeException("start > length()"); } if (start > end) { throw new IndexOutOfRangeException("start > end"); } if (end > count) { end = count; } int len = str.length(); int newCount = count + len - (end - start); ensureCapacityInternal(newCount); Array.Copy(value, end, value, start + len, count - end); str.getChars(value, start); count = newCount; return(this); }
public virtual AbstractStringBuilder replace(int start, int end, String str) { if (start < 0) throw new IndexOutOfRangeException(); if (start > count) throw new IndexOutOfRangeException("start > length()"); if (start > end) throw new IndexOutOfRangeException("start > end"); if (end > count) end = count; int len = str.length(); int newCount = count + len - (end - start); ensureCapacityInternal(newCount); Array.Copy(value, end, value, start + len, count - end); str.getChars(value, start); count = newCount; return this; }
/* void writeLongUTF(String s) { writeLongUTF(s, getUTFLength(s)); } internal void writeLongUTF(String s, long utflen) { writeLong(utflen); if (utflen == (long) s.length()) { writeBytes(s); } else { writeUTFBody(s); } } */ private void writeUTFBody(String s) { int limit = MAX_BLOCK_SIZE - 3; int len = s.length(); for (int off = 0; off < len; ) { int csize = Math.min(len - off, CHAR_BUF_SIZE); s.getChars(off, off + csize, cbuf, 0); for (int cpos = 0; cpos < csize; cpos++) { char c = cbuf[cpos]; if (pos <= limit) { if (c <= 0x007F && c != 0) { buf[pos++] = (byte) c; } else if (c > 0x07FF) { buf[pos + 2] = (byte) (0x80 | ((c >> 0) & 0x3F)); buf[pos + 1] = (byte) (0x80 | ((c >> 6) & 0x3F)); buf[pos + 0] = (byte) (0xE0 | ((c >> 12) & 0x0F)); pos += 3; } else { buf[pos + 1] = (byte) (0x80 | ((c >> 0) & 0x3F)); buf[pos + 0] = (byte) (0xC0 | ((c >> 6) & 0x1F)); pos += 2; } } else { // write one byte at a time to normalize block if (c <= 0x007F && c != 0) { write(c); } else if (c > 0x07FF) { write(0xE0 | ((c >> 12) & 0x0F)); write(0x80 | ((c >> 6) & 0x3F)); write(0x80 | ((c >> 0) & 0x3F)); } else { write(0xC0 | ((c >> 6) & 0x1F)); write(0x80 | ((c >> 0) & 0x3F)); } } } off += csize; } }
/* void writeFloats(float[] v, int off, int len) { int limit = MAX_BLOCK_SIZE - 4; int endoff = off + len; while (off < endoff) { if (pos <= limit) { int avail = (MAX_BLOCK_SIZE - pos) >> 2; int chunklen = Math.min(endoff - off, avail); floatsToBytes(v, off, buf, pos, chunklen); off += chunklen; pos += chunklen << 2; } else { dout.writeFloat(v[off++]); } } } void writeLongs(long[] v, int off, int len) { int limit = MAX_BLOCK_SIZE - 8; int endoff = off + len; while (off < endoff) { if (pos <= limit) { int avail = (MAX_BLOCK_SIZE - pos) >> 3; int stop = Math.min(endoff, off + avail); while (off < stop) { Bits.putLong(buf, pos, v[off++]); pos += 8; } } else { dout.writeLong(v[off++]); } } } */ /* void writeDoubles(double[] v, int off, int len) { int limit = MAX_BLOCK_SIZE - 8; int endoff = off + len; while (off < endoff) { if (pos <= limit) { int avail = (MAX_BLOCK_SIZE - pos) >> 3; int chunklen = Math.min(endoff - off, avail); doublesToBytes(v, off, buf, pos, chunklen); off += chunklen; pos += chunklen << 3; } else { dout.writeDouble(v[off++]); } } } */ internal long getUTFLength(String s) { int len = s.length(); long utflen = 0; for (int off = 0; off < len; ) { int csize = Math.min(len - off, CHAR_BUF_SIZE); s.getChars(off, off + csize, cbuf, 0); for (int cpos = 0; cpos < csize; cpos++) { char c = cbuf[cpos]; if (c >= 0x0001 && c <= 0x007F) { utflen++; } else if (c > 0x07FF) { utflen += 3; } else { utflen += 2; } } off += csize; } return utflen; }
public void writeChars(String s) { int endoff = s.length(); for (int off = 0; off < endoff; ) { int csize = Math.min(endoff - off, CHAR_BUF_SIZE); s.getChars(off, off + csize, cbuf, 0); writeChars(cbuf, 0, csize); off += csize; } }
/* public void writeFloat(float v) { if (pos + 4 <= MAX_BLOCK_SIZE) { Bits.putFloat(buf, pos, v); pos += 4; } else { dout.writeFloat(v); } } public void writeLong(long v) { if (pos + 8 <= MAX_BLOCK_SIZE) { Bits.putLong(buf, pos, v); pos += 8; } else { dout.writeLong(v); } } public void writeDouble(double v) { if (pos + 8 <= MAX_BLOCK_SIZE) { Bits.putDouble(buf, pos, v); pos += 8; } else { dout.writeDouble(v); } } */ public void writeBytes(String s) { int endoff = s.length(); int cpos = 0; int csize = 0; for (int off = 0; off < endoff; ) { if (cpos >= csize) { cpos = 0; csize = Math.min(endoff - off, CHAR_BUF_SIZE); s.getChars(off, off + csize, cbuf, 0); } if (pos >= MAX_BLOCK_SIZE) { drain(); } int n = Math.min(csize - cpos, MAX_BLOCK_SIZE - pos); int stop = pos + n; while (pos < stop) { buf[pos++] = (byte) cbuf[cpos++]; } off += n; } }