public static Buf toBuf(string self, Charset charset) { MemBuf buf = new MemBuf(self.Length * 2); buf.charset(charset); buf.print(self); return(buf.flip()); }
public Buf dup() { int size = (int)this.size(); byte[] copy = new byte[size]; getBytes(0, copy, 0, size); Buf result = new MemBuf(copy, size); result.charset(charset()); return(result); }
public Buf getRange(Range range) { long size = getSize(); long s = range.start(size); long e = range.end(size); int n = (int)(e - s + 1); if (n < 0) { throw IndexErr.make(range).val; } byte[] slice = new byte[n]; getBytes(s, slice, 0, n); Buf result = new MemBuf(slice, n); result.charset(charset()); return(result); }
public Buf getRange(Range range) { long size = getSize(); long s = range.start(size); long e = range.end(size); int n = (int)(e - s + 1); if (n < 0) throw IndexErr.make(range).val; byte[] slice = new byte[n]; getBytes(s, slice, 0, n); Buf result = new MemBuf(slice, n); result.charset(charset()); return result; }
public Buf dup() { int size = (int)this.size(); byte[] copy = new byte[size]; getBytes(0, copy, 0, size); Buf result = new MemBuf(copy, size); result.charset(charset()); return result; }
public static Buf toBuf(string self, Charset charset) { MemBuf buf = new MemBuf(self.Length*2); buf.charset(charset); buf.print(self); return buf.flip(); }