1/* Title: Pure/System/isabelle_charset.scala 2 Author: Makarius 3 4Charset for Isabelle symbols. 5*/ 6 7package isabelle 8 9 10import java.nio.Buffer 11import java.nio.{ByteBuffer, CharBuffer} 12import java.nio.charset.{Charset, CharsetDecoder, CharsetEncoder, CoderResult} 13import java.nio.charset.spi.CharsetProvider 14 15import scala.collection.JavaConverters 16 17 18object Isabelle_Charset 19{ 20 val name: String = "UTF-8-Isabelle-test" // FIXME 21 lazy val charset: Charset = new Isabelle_Charset 22} 23 24 25class Isabelle_Charset extends Charset(Isabelle_Charset.name, null) 26{ 27 override def contains(cs: Charset): Boolean = 28 cs.name.equalsIgnoreCase(UTF8.charset_name) || UTF8.charset.contains(cs) 29 30 override def newDecoder(): CharsetDecoder = UTF8.charset.newDecoder 31 32 override def newEncoder(): CharsetEncoder = UTF8.charset.newEncoder 33} 34 35 36class Isabelle_Charset_Provider extends CharsetProvider 37{ 38 override def charsetForName(name: String): Charset = 39 { 40 // FIXME inactive 41 // if (name.equalsIgnoreCase(Isabelle_Charset.name)) Isabelle_Charset.charset 42 // else null 43 null 44 } 45 46 override def charsets(): java.util.Iterator[Charset] = 47 { 48 // FIXME inactive 49 // Iterator(Isabelle_Charset.charset) 50 JavaConverters.asJavaIterator(Iterator()) 51 } 52} 53