diff options
author | Paul Phillips <paulp@improving.org> | 2009-04-24 19:52:39 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-04-24 19:52:39 +0000 |
commit | 458c4128c8398e050559bbf620d692cd711a5fe1 (patch) | |
tree | 54a79c1f067128225045fca3af4ae46961c80a7a /src/compiler | |
parent | d1cd9999f24c4c0adde389f62c5eaa4876bbea55 (diff) | |
download | scala-458c4128c8398e050559bbf620d692cd711a5fe1.tar.gz scala-458c4128c8398e050559bbf620d692cd711a5fe1.tar.bz2 scala-458c4128c8398e050559bbf620d692cd711a5fe1.zip |
Removed redundant scala.tools.util.UTF8Codec.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Names.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/util/UTF8Codec.scala | 82 |
3 files changed, 2 insertions, 84 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Names.scala b/src/compiler/scala/tools/nsc/symtab/Names.scala index c692f20761..492198e081 100644 --- a/src/compiler/scala/tools/nsc/symtab/Names.scala +++ b/src/compiler/scala/tools/nsc/symtab/Names.scala @@ -7,7 +7,7 @@ package scala.tools.nsc.symtab import scala.tools.nsc.util.NameTransformer -import scala.tools.util.UTF8Codec +import scala.io.UTF8Codec import java.security.MessageDigest /** The class <code>Names</code> ... diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala index 82df45dd2d..a3e2a2061d 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala @@ -10,7 +10,7 @@ import java.io.IOException import java.lang.{Float, Double} import scala.tools.nsc.util.{Position, NoPosition} -import scala.tools.util.UTF8Codec +import scala.io.UTF8Codec import Flags._ import PickleFormat._ diff --git a/src/compiler/scala/tools/util/UTF8Codec.scala b/src/compiler/scala/tools/util/UTF8Codec.scala deleted file mode 100644 index 16414b75e5..0000000000 --- a/src/compiler/scala/tools/util/UTF8Codec.scala +++ /dev/null @@ -1,82 +0,0 @@ -/* __ *\ -** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** -** /____/\___/_/ |_/____/_/ | | ** -** |/ ** -\* */ - -// $Id$ - -package scala.tools.util - -/** This object provides methods for encoding/decoding UTF-8 characters. - * - * @author Martin Odersky - * @version 1.0 - */ -object UTF8Codec { - - def encode(src: Array[Char], from: Int, dst: Array[Byte], to: Int, len: Int): Int = { - var i = from - var j = to - val end = from + len - while (i < end) { - val ch = src(i) - i += 1 - if (ch < 128) { - dst(j) = ch.toByte - j += 1 - } - else if (ch <= 0x3FF) { - dst(j) = (0xC0 | (ch >> 6)).toByte - dst(j+1) = (0x80 | (ch & 0x3F)).toByte - 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 += 3 - } - } - j - } - - 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) - dst.subArray(0, len) - } - - def decode(src: Array[Byte], from: Int, - dst: Array[Char], to: Int, len: Int): Int = - { - var i = from - var j = to - val end = from + len - while (i < end) { - var b = src(i) & 0xFF - i += 1 - if (b >= 0xE0) { - b = ((b & 0x0F) << 12) | (src(i) & 0x3F) << 6 - b = b | (src(i+1) & 0x3F) - i += 2 - } else if (b >= 0xC0) { - b = ((b & 0x1F) << 6) | (src(i) & 0x3F) - i += 1 - } - dst(j) = b.toChar - j += 1 - } - j - } - - def decode(src: Array[Byte], from: Int, len: Int): String = { - val cs = new Array[Char](len) - new String(cs, 0, decode(src, 0, cs, 0, len)) - } - -} |