src/Pure/System/isabelle_system.scala
changeset 34162 610ec1e0c848
parent 34137 6cc9a0cbaf55
child 34163 69b7e50656c3
equal deleted inserted replaced
34161:4c845a8f1357 34162:610ec1e0c848
     6 
     6 
     7 package isabelle
     7 package isabelle
     8 
     8 
     9 import java.util.regex.Pattern
     9 import java.util.regex.Pattern
    10 import java.util.Locale
    10 import java.util.Locale
    11 import java.io.{BufferedInputStream, FileInputStream, File, IOException}
    11 import java.io.{BufferedInputStream, FileInputStream, BufferedReader, InputStreamReader,
       
    12   File, IOException}
    12 import java.awt.{GraphicsEnvironment, Font}
    13 import java.awt.{GraphicsEnvironment, Font}
    13 
    14 
    14 import scala.io.Source
    15 import scala.io.Source
    15 import scala.util.matching.Regex
    16 import scala.util.matching.Regex
    16 
    17 
    40   {
    41   {
    41     proc.getOutputStream.close
    42     proc.getOutputStream.close
    42     val output = Source.fromInputStream(proc.getInputStream, charset).mkString
    43     val output = Source.fromInputStream(proc.getInputStream, charset).mkString
    43     val rc = proc.waitFor
    44     val rc = proc.waitFor
    44     (output, rc)
    45     (output, rc)
       
    46   }
       
    47 
       
    48 
       
    49   /* platform files */
       
    50 
       
    51   def read_file(file: File): String =
       
    52   {
       
    53     val buf = new StringBuilder(file.length.toInt)
       
    54     val reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), charset))
       
    55     var c = reader.read
       
    56     while (c != -1) {
       
    57       buf.append(c.toChar)
       
    58       c = reader.read
       
    59     }
       
    60     buf.toString
    45   }
    61   }
    46 }
    62 }
    47 
    63 
    48 
    64 
    49 class Isabelle_System
    65 class Isabelle_System