summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2010-09-28 12:43:34 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2010-09-28 12:43:34 +0000
commit5b79a0442369d55094244e08f8a2c8c2ff117007 (patch)
tree3b28042b6f7ccbdd56a341b8cbe8f7bcb59a849a /src/library
parent16dd1e6bfd7e55930becedf03f54261a0faa814e (diff)
downloadscala-5b79a0442369d55094244e08f8a2c8c2ff117007.tar.gz
scala-5b79a0442369d55094244e08f8a2c8c2ff117007.tar.bz2
scala-5b79a0442369d55094244e08f8a2c8c2ff117007.zip
Merged revisions 23108,23119 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r23108 | rytz | 2010-09-27 11:56:19 +0200 (Mon, 27 Sep 2010) | 1 line close #3864. the error was introduced by commit r22418, which was merged into 2.8.x in r22894. review by dubochet, michelou. ........ r23119 | rytz | 2010-09-28 14:27:53 +0200 (Tue, 28 Sep 2010) | 1 line Update comment in ByteCodecs. No review. ........
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/reflect/generic/ByteCodecs.scala17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/library/scala/reflect/generic/ByteCodecs.scala b/src/library/scala/reflect/generic/ByteCodecs.scala
index fd2e326e19..46146e9e4b 100644
--- a/src/library/scala/reflect/generic/ByteCodecs.scala
+++ b/src/library/scala/reflect/generic/ByteCodecs.scala
@@ -193,7 +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 */
+ /**
+ * 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)