/* * public String(byte[] bytes, int offset, int length, String charsetName) { * if (charsetName == null) * throw new ArgumentNullException("charsetName"); * checkBounds(bytes, offset, length); * this.value = StringCoding.decode(charsetName, bytes, offset, length); * } * * public String(byte[] bytes, int offset, int length, Charset charset) { * if (charset == null) * throw new ArgumentNullException("charset"); * checkBounds(bytes, offset, length); * this.value = StringCoding.decode(charset, bytes, offset, length); * } * * public String(byte[] bytes, String charsetName) { * this(bytes, 0, bytes.length, charsetName); * } * * public String(byte[] bytes, Charset charset) { * this(bytes, 0, bytes.length, charset); * } * * public String(byte[] bytes, int offset, int length) { * checkBounds(bytes, offset, length); * this.value = StringCoding.decode(bytes, offset, length); * } * * public String(byte[] bytes) { * this(bytes, 0, bytes.Length); * } */ public String(StringBuffer buffer) { lock (buffer) { this.value = Arrays.copyOf(buffer.getValue(), buffer.length()); } }