author | wenzelm |
Sun, 25 Nov 2012 20:17:04 +0100 | |
changeset 50203 | 00d8ad713e32 |
parent 44778 | 18b1ba7cfcfe |
child 55618 | 995162143ef4 |
permissions | -rw-r--r-- |
43517 | 1 |
/* Title: Pure/System/isabelle_charset.scala |
2 |
Author: Makarius |
|
3 |
||
4 |
Charset for Isabelle symbols. |
|
5 |
*/ |
|
6 |
||
7 |
package isabelle |
|
8 |
||
9 |
import java.nio.Buffer |
|
10 |
import java.nio.{ByteBuffer, CharBuffer} |
|
11 |
import java.nio.charset.{Charset, CharsetDecoder, CharsetEncoder, CoderResult} |
|
12 |
import java.nio.charset.spi.CharsetProvider |
|
13 |
||
14 |
||
15 |
object Isabelle_Charset |
|
16 |
{ |
|
17 |
val name: String = "UTF-8-Isabelle-test" // FIXME |
|
18 |
lazy val charset: Charset = new Isabelle_Charset |
|
19 |
} |
|
20 |
||
21 |
||
22 |
class Isabelle_Charset extends Charset(Isabelle_Charset.name, null) |
|
23 |
{ |
|
24 |
override def contains(cs: Charset): Boolean = |
|
50203 | 25 |
cs.name.equalsIgnoreCase(UTF8.charset_name) || UTF8.charset.contains(cs) |
43517 | 26 |
|
50203 | 27 |
override def newDecoder(): CharsetDecoder = UTF8.charset.newDecoder |
43517 | 28 |
|
50203 | 29 |
override def newEncoder(): CharsetEncoder = UTF8.charset.newEncoder |
43517 | 30 |
} |
31 |
||
32 |
||
33 |
class Isabelle_Charset_Provider extends CharsetProvider |
|
34 |
{ |
|
35 |
override def charsetForName(name: String): Charset = |
|
36 |
{ |
|
44778
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
37 |
// FIXME inactive |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
38 |
// if (name.equalsIgnoreCase(Isabelle_Charset.name)) Isabelle_Charset.charset |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
39 |
// else null |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
40 |
null |
43517 | 41 |
} |
42 |
||
43 |
override def charsets(): java.util.Iterator[Charset] = |
|
44 |
{ |
|
45 |
import scala.collection.JavaConversions._ |
|
44778
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
46 |
// FIXME inactive |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
47 |
// Iterator(Isabelle_Charset.charset) |
18b1ba7cfcfe
deactivate unfinished charset provider for now, to avoid user confusion;
wenzelm
parents:
43517
diff
changeset
|
48 |
Iterator() |
43517 | 49 |
} |
50 |
} |
|
51 |