You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2010/05/03 19:59:27 UTC
svn commit: r940542 - in
/lucene/dev/trunk/lucene/src/java/org/apache/lucene/util: BytesRef.java
UnicodeUtil.java
Author: yonik
Date: Mon May 3 17:59:27 2010
New Revision: 940542
URL: http://svn.apache.org/viewvc?rev=940542&view=rev
Log:
javadoc: define UTF16toUTF8 result.offset=0, doc that BytesRef references byte[] instead of copying
Modified:
lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/BytesRef.java
lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/UnicodeUtil.java
Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/BytesRef.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/BytesRef.java?rev=940542&r1=940541&r2=940542&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/BytesRef.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/BytesRef.java Mon May 3 17:59:27 2010
@@ -40,7 +40,9 @@ public final class BytesRef implements C
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 C
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;
Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/UnicodeUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/UnicodeUtil.java?rev=940542&r1=940541&r2=940542&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/UnicodeUtil.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/util/UnicodeUtil.java Mon May 3 17:59:27 2010
@@ -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;