diff options
author | michelou <michelou@epfl.ch> | 2008-01-31 10:19:40 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-01-31 10:19:40 +0000 |
commit | 7bee443fb82b9f637ba422c464acfb3340b9496c (patch) | |
tree | ca1e8f354c44fcad82c752ee35979ce8d17ae638 /src | |
parent | eb71465d1d584685f360929d2fe083f7b72e3000 (diff) | |
download | scala-7bee443fb82b9f637ba422c464acfb3340b9496c.tar.gz scala-7bee443fb82b9f637ba422c464acfb3340b9496c.tar.bz2 scala-7bee443fb82b9f637ba422c464acfb3340b9496c.zip |
added svn:keywords, updated headers
Diffstat (limited to 'src')
-rw-r--r-- | src/library/scala/io/BufferedSource.scala | 6 | ||||
-rw-r--r-- | src/library/scala/io/Position.scala | 4 | ||||
-rw-r--r-- | src/library/scala/io/UTF8Codec.scala | 31 |
3 files changed, 20 insertions, 21 deletions
diff --git a/src/library/scala/io/BufferedSource.scala b/src/library/scala/io/BufferedSource.scala index f2e766ab20..2fae69fb10 100644 --- a/src/library/scala/io/BufferedSource.scala +++ b/src/library/scala/io/BufferedSource.scala @@ -7,14 +7,14 @@ \* */ // $Id$ + + package scala.io -import java.io.{BufferedInputStream, File, FileInputStream, InputStream, - PrintStream} +import java.io.InputStream import java.nio.{ByteBuffer, CharBuffer} import java.nio.channels.{ByteChannel, Channels, ReadableByteChannel} import java.nio.charset.{Charset, CharsetDecoder} -import java.net.{URI, URL} object BufferedSource { diff --git a/src/library/scala/io/Position.scala b/src/library/scala/io/Position.scala index b31b22c71c..228e4f5547 100644 --- a/src/library/scala/io/Position.scala +++ b/src/library/scala/io/Position.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2003-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ diff --git a/src/library/scala/io/UTF8Codec.scala b/src/library/scala/io/UTF8Codec.scala index 2c2218766b..76173cf9eb 100644 --- a/src/library/scala/io/UTF8Codec.scala +++ b/src/library/scala/io/UTF8Codec.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2003-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -24,8 +24,8 @@ object UTF8Codec { */ def encode(ch1: Int): Array[Byte] = { var ch = ch1 - val byteMask = 0xBF; - val byteMark = 0x80; + val byteMask = 0xBF + val byteMark = 0x80 var bytesToWrite = 0 val firstByteMark = List[Byte](0x00.asInstanceOf[Byte], 0x00.asInstanceOf[Byte], 0xC0.asInstanceOf[Byte], 0xE0.asInstanceOf[Byte], 0xF0.asInstanceOf[Byte], 0xF8.asInstanceOf[Byte], 0xFC.asInstanceOf[Byte]) @@ -39,13 +39,13 @@ object UTF8Codec { var bw = bytesToWrite if(bw>=4) { - res(3) = ((ch | byteMark) & byteMask).asInstanceOf[Byte]; ch = ch >> 6; bw = bw - 1 + res(3) = ((ch | byteMark) & byteMask).asInstanceOf[Byte]; ch = ch >> 6; bw -= 1 } if(bw>=3) { - res(2) = ((ch | byteMark) & byteMask).asInstanceOf[Byte]; ch = ch >> 6; bw = bw - 1 + res(2) = ((ch | byteMark) & byteMask).asInstanceOf[Byte]; ch = ch >> 6; bw -= 1 } if(bw>=2) { - res(1) = ((ch | byteMark) & byteMask).asInstanceOf[Byte]; ch = ch >> 6; bw = bw - 1 + res(1) = ((ch | byteMark) & byteMask).asInstanceOf[Byte]; ch = ch >> 6; bw -= 1 } if(bw>=1) { res(0) = (ch | firstByteMark(bytesToWrite)).asInstanceOf[Byte] @@ -59,20 +59,20 @@ object UTF8Codec { val end = from + len while (i < end) { val ch = src(i) - i = i + 1 + i += 1 if (ch < 128) { dst(j) = ch.toByte - j = j + 1 + j += 1 } else if (ch <= 0x3FF) { dst(j) = (0xC0 | (ch >> 6)).toByte dst(j+1) = (0x80 | (ch & 0x3F)).toByte - j = j + 2 + j += 2 } else { dst(j) = (0xE0 | (ch >> 12)).toByte dst(j+1) = (0x80 | ((ch >> 6) & 0x3F)).toByte dst(j+2) = (0x80 | (ch & 0x3F)).toByte - j = j + 3 + j += 3 } } j @@ -81,7 +81,6 @@ object UTF8Codec { def encode(s: String, dst: Array[Byte], to: Int): Int = encode(s.toCharArray(), 0, dst, to, s.length()) - def encode(s: String): Array[Byte] = { val dst = new Array[Byte](s.length() * 3) val len = encode(s, dst, 0) @@ -96,17 +95,17 @@ object UTF8Codec { val end = from + len while (i < end) { var b = src(i) & 0xFF - i = i + 1 + i += 1 if (b >= 0xE0) { b = ((b & 0x0F) << 12) | (src(i) & 0x3F) << 6 b = b | (src(i+1) & 0x3F) - i = i + 2 + i += 2 } else if (b >= 0xC0) { b = ((b & 0x1F) << 6) | (src(i) & 0x3F) - i = i + 1 + i += 1 } dst(j) = b.toChar - j = j + 1 + j += 1 } j } |