summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2010-09-28 12:27:53 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2010-09-28 12:27:53 +0000
commit0b70eebcab729515ceeacd573650899789a3a37c (patch)
tree6ae4560d58d57a98e7ca38026db3c5445922985f /src
parent7032d7dbdccb871ab3ea1eaa2cabdbbb2d1d5e09 (diff)
downloadscala-0b70eebcab729515ceeacd573650899789a3a37c.tar.gz
scala-0b70eebcab729515ceeacd573650899789a3a37c.tar.bz2
scala-0b70eebcab729515ceeacd573650899789a3a37c.zip
Update comment in ByteCodecs. No review.
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/reflect/generic/ByteCodecs.scala19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/library/scala/reflect/generic/ByteCodecs.scala b/src/library/scala/reflect/generic/ByteCodecs.scala
index 4bd82ec286..46146e9e4b 100644
--- a/src/library/scala/reflect/generic/ByteCodecs.scala
+++ b/src/library/scala/reflect/generic/ByteCodecs.scala
@@ -193,9 +193,22 @@ object ByteCodecs {
@deprecated("use 1-argument version instead")
def decode(xs: Array[Byte], dstlen: Int) { decode(xs) }
- /** Destructively decode array xs and returns the length of the decoded array
- * LUKAS: my testing showed that this actually retruns the length of the
- * decoded array + 1. Gilles, please check. */
+ /**
+ * Destructively decodes array xs and returns the length of the decoded array.
+ *
+ * Sometimes returns (length+1) of the decoded array. Example:
+ *
+ * scala> val enc = reflect.generic.ByteCodecs.encode(Array(1,2,3))
+ * enc: Array[Byte] = Array(2, 5, 13, 1)
+ *
+ * scala> reflect.generic.ByteCodecs.decode(enc)
+ * res43: Int = 4
+ *
+ * scala> enc
+ * res44: Array[Byte] = Array(1, 2, 3, 0)
+ *
+ * However, this does not always happen.
+ */
def decode(xs: Array[Byte]): Int = {
val len = regenerateZero(xs)
decode7to8(xs, len)