javadoc: define UTF16toUTF8 result.offset=0, doc that BytesRef references byte[] instead of copying

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@940542 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-05-03 17:59:27 +00:00
parent 9b9a365bd0
commit 4258ebca68
2 changed files with 8 additions and 5 deletions

View File

@ -40,7 +40,9 @@ public final class BytesRef implements Comparable<BytesRef> {
bytes = EMPTY_BYTES;
}
/** bytes[] should not be null */
/** This instance will directly reference bytes w/o making a copy.
* bytes should not be null.
*/
public BytesRef(byte[] bytes, int offset, int length) {
assert bytes != null;
this.bytes = bytes;
@ -48,7 +50,8 @@ public final class BytesRef implements Comparable<BytesRef> {
this.length = length;
}
/** bytes[] should not be null */
/** This instance will directly reference bytes w/o making a copy.
* bytes should not be null */
public BytesRef(byte[] bytes) {
assert bytes != null;
this.bytes = bytes;

View File

@ -99,7 +99,7 @@ final public class UnicodeUtil {
}
/** Encode characters from a char[] source, starting at
* offset for length chars. Returns a hash of the resulting bytes */
* offset for length chars. Returns a hash of the resulting bytes. After encoding, result.offset will always be 0. */
public static int UTF16toUTF8WithHash(final char[] source, final int offset, final int length, BytesRef result) {
int hash = 0;
int upto = 0;
@ -154,7 +154,7 @@ final public class UnicodeUtil {
}
/** Encode characters from a char[] source, starting at
* offset for length chars.
* offset for length chars. After encoding, result.offset will always be 0.
*/
public static void UTF16toUTF8(final char[] source, final int offset, final int length, BytesRef result) {
@ -209,7 +209,7 @@ final public class UnicodeUtil {
}
/** Encode characters from this String, starting at offset
* for length characters.
* for length characters. After encoding, result.offset will always be 0.
*/
public static void UTF16toUTF8(final CharSequence s, final int offset, final int length, BytesRef result) {
final int end = offset + length;