diff options
author | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-04-07 12:15:54 +0000 |
---|---|---|
committer | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-04-07 12:15:54 +0000 |
commit | 48fdb8620aeb3253f0048667044b39301c1d77c8 (patch) | |
tree | 1677e938deef28b99a0d0cd2022c34f05c906d92 /src/library/scala/compat/Platform.scala | |
parent | 09d3a7bb5b1a96300b78e7f1b38f135c5ab80d20 (diff) | |
download | scala-48fdb8620aeb3253f0048667044b39301c1d77c8.tar.gz scala-48fdb8620aeb3253f0048667044b39301c1d77c8.tar.bz2 scala-48fdb8620aeb3253f0048667044b39301c1d77c8.zip |
New reorg plan
Diffstat (limited to 'src/library/scala/compat/Platform.scala')
-rw-r--r-- | src/library/scala/compat/Platform.scala | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/library/scala/compat/Platform.scala b/src/library/scala/compat/Platform.scala new file mode 100644 index 0000000000..03cf1d28e2 --- /dev/null +++ b/src/library/scala/compat/Platform.scala @@ -0,0 +1,60 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id$ + + +package scala.compat + + +import java.lang.System +import Predef._ + +object Platform { + + type StackOverflowError = java.lang.StackOverflowError + type ConcurrentModificationException = java.util.ConcurrentModificationException + + /** + * @param src .. + * @param srcPos .. + * @param dest .. + * @param destPos .. + * @param length .. + */ + def arraycopy(src: AnyRef, srcPos: Int, dest: AnyRef, destPos: Int, length: Int) { + System.arraycopy(src, srcPos, dest, destPos, length) + } + + /** Create array of the same type as arrayInstance with the given + * length. + * + * @param elemClass .. + * @param length .. + * @return .. + */ + def createArray(elemClass: Class[_], length: Int): AnyRef = + java.lang.reflect.Array.newInstance(elemClass, length) + + def arrayclear(arr: Array[Int]) { java.util.Arrays.fill(arr, 0) } + + def getClassForName(name: String): Class[_] = java.lang.Class.forName(name) + + val EOL = System.getProperty("line.separator", "\n") + + def currentTime: Long = System.currentTimeMillis() + + def collectGarbage: Unit = System.gc() + + /** The name of the default character set encoding as a string */ + def defaultCharsetName: String = { + import java.io._ + new OutputStreamWriter(new ByteArrayOutputStream).getEncoding() + } + +} |