Module Java.IO

Classes from java.io

Imports

Table of Content

Definitions

data FileNotFoundException = pure native java.io.FileNotFoundException
data UnsupportedEncodingException = pure native java.io.UnsupportedEncodingException
data EOFException = pure native java.io.EOFException

Member Functions

newStringEOFException
pure native new
data OutputStream = mutable native java.io.OutputStream

frege equivalent of java.io.OutputStream

data FileOutputStream = mutable native java.io.FileOutputStream

frege equivalent of java.io.FileOutputStream

Member Functions

newMutableIO FileIO FileOutputStream
         throws FileNotFoundException
     | MutableIO FileBoolIO FileOutputStream
         throws FileNotFoundException
     | StringIO FileOutputStream
         throws FileNotFoundException
     | StringBoolIO FileOutputStream
         throws FileNotFoundException
native new
 FileOutputStream.new file true

writes to the end of a file rather than the beginning

newαMutableIO FileIO FileOutputStream
native new  throws FileNotFoundException  overloads new
 FileOutputStream.new file true

writes to the end of a file rather than the beginning

newβMutableIO FileBoolIO FileOutputStream
native new  throws FileNotFoundException  overloads new
 FileOutputStream.new file true

writes to the end of a file rather than the beginning

newγStringIO FileOutputStream
native new  throws FileNotFoundException  overloads new
 FileOutputStream.new file true

writes to the end of a file rather than the beginning

newδStringBoolIO FileOutputStream
native new  throws FileNotFoundException  overloads new
 FileOutputStream.new file true

writes to the end of a file rather than the beginning

writeFileOutputStreamIntIO ()
native write  throws IOException

Writes the specified byte to this file output stream.

data Closeable = mutable native java.io.Closeable

frege equivalent of java.io.Closeable

Member Functions

closeCloseableIO ()
native close  throws IOException
data Flushable = mutable native java.io.Flushable

frege equivalent of java.io.Flushable

Member Functions

flushFlushableIO ()
native flush  throws IOException
data URI = pure native java.net.URI

forward declaration of URI

data File = native java.io.File

Member Functions

canReadMutableIO FileIO Bool
native canRead
canWriteMutableIO FileIO Bool
native canWrite
createTempFileStringStringSTMutable RealWorld File
native java.io.File.createTempFile  throws IOException

Create an empty file in the default temp directory.

 createTempFile "abc" ".suffix"

The prefix must be at least 3 characters long!

deleteMutableIO FileIO Bool
native delete
existsMutableIO FileIO Bool
native exists
getNameMutableIO FileIO String
native getName
getParentFileMutableIO FileIO (Maybe (MutableIO File))
native getParentFile
getPathMutableIO FileIO String
native getPath

The (relative) path name. Not necessarily valid.

getPathFFileString
pure native getPath
isAbsoluteMutableIO FileIO Bool
native isAbsolute
isDirectoryMutableIO FileIO Bool
native isDirectory
isFileMutableIO FileIO Bool
native isFile
lastModifiedMutableIO FileIO Long
native lastModified
listMutableIO FileIO (Maybe (ArrayOf RealWorld String))
native list
mkdirsMutableIO FileIO Bool
native mkdirs
newStringSTMutable s File
     | Mutable s FileStringSTMutable s File
native new
newαStringSTMutable s File
native new  overloads new
newβMutable s FileStringSTMutable s File
native new  overloads new
pathSeparatorString
pure native java.io.File.pathSeparator

Separator for elements of a path, i.e. ":" on Unix

renameToMutableIO FileMutableIO FileIO Bool
native renameTo
separatorString
pure native java.io.File.separator

Separator for elements of a path name, i.e. "/" on Unix

toURIFileURI
pure native toURI
data Writer = mutable native java.io.Writer

Member Functions

putCharWriterCharIO ()
writeWriterIntIO ()
           throws IOException
       | WriterStringIO ()
           throws IOException
       | WriterStringIntIntIO ()
           throws IOException
native write
writeαWriterIntIO ()
native write  throws IOException  overloads write
writeβWriterStringIO ()
native write  throws IOException  overloads write
writeγWriterStringIntIntIO ()
native write  throws IOException  overloads write
data OutputStreamWriter = mutable native java.io.OutputStreamWriter

Member Functions

newOutputStreamStringIO OutputStreamWriter
native new  throws UnsupportedEncodingException
data PrintWriter = mutable native java.io.PrintWriter

Member Functions

newStringIO PrintWriter
         throws FileNotFoundException
     | MutableIO FileIO PrintWriter
         throws FileNotFoundException
     | MutableIO FileStringIO PrintWriter
         throws FileNotFoundException, UnsupportedEncodingException
     | WriterIO PrintWriter
     | WriterBoolIO PrintWriter
native new
newαStringIO PrintWriter
native new  throws FileNotFoundException  overloads new
newβMutableIO FileIO PrintWriter
native new  throws FileNotFoundException  overloads new
newγMutableIO FileStringIO PrintWriter
native new  throws FileNotFoundException, UnsupportedEncodingException  overloads new
newδWriterIO PrintWriter
native new  overloads new
newεWriterBoolIO PrintWriter
native new  overloads new
printPrintWriterStringIO ()
native print

print a String

printfPrintWriterString → a → IO ()
        | PrintWriterString → a → b → IO ()
        | PrintWriterString → a → b → c → IO ()
        | PrintWriterString → a → b → c → d → IO ()
        | PrintWriterString → a → b → c → d → e → IO ()
        | PrintWriterString → a → b → c → d → e → f → IO ()
        | PrintWriterString → a → b → c → d → e → f → g → IO ()
        | PrintWriterString → a → b → c → d → e → f → g → h → IO ()
        | PrintWriterString → a → b → c → d → e → f → g → h → i → IO ()
native printf

format and print 1 to 9 values, see StringJ.format

printfαPrintWriterStringaIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfβPrintWriterStringabIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfγPrintWriterStringabcIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfδPrintWriterStringabcdIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfεPrintWriterStringabcdeIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfζPrintWriterStringabcdefIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfηPrintWriterStringabcdefgIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfθPrintWriterStringabcdefghIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printfιPrintWriterStringabcdefghiIO ()
native printf  overloads printf

format and print 1 to 9 values, see StringJ.format

printlnPrintWriterStringIO ()
         | PrintWriterIO ()
native println

print a String followed by a line terminator, or just a line terminator

printlnαPrintWriterStringIO ()
native println  overloads println

print a String followed by a line terminator, or just a line terminator

printlnβPrintWriterIO ()
native println  overloads println

print a String followed by a line terminator, or just a line terminator

stdoutPrintWriter
native frege.runtime.Runtime.stdout.get()

nowarn: Don't warn because of constantness

The standard output PrintWriter

stderrPrintWriter
native frege.runtime.Runtime.stderr.get()

nowarn: Don't warn because of constantness

The standard error PrintWriter

stdinBufferedReader
native frege.runtime.Runtime.stdin.get()

nowarn: Don't warn because of constantness

The standard input BufferedReader

data StringWriter = mutable native java.io.StringWriter

Frege type for a java.io.StringWriter

Not intended for direct use but rather as something a PrintWriter can be made of. (Though, because of the Appendable inheritance, one could still Appendable.append directly.)

To be used like:

 action :: PrintWriter -> IO ()
 action =  ...
 actionOnStringWriter :: IO String
 actionOnStringWriter = do
       sw <- StringWriter.new
       pr <- sw.printer
       action pr
       pr.close
       sw.toString

Member Functions

new()IO StringWriter
native new

create a fresh StringWriter

printerStringWriterIO PrintWriter

make a PrintWriter that prints to this StringWriter

toStringStringWriterIO String
native toString

get the content of a StringWriter as String

data InputStream = mutable native java.io.InputStream
data FileInputStream = mutable native java.io.FileInputStream

Member Functions

newMutableIO FileIO FileInputStream
         throws FileNotFoundException
     | StringIO FileInputStream
         throws FileNotFoundException
native new
newαMutableIO FileIO FileInputStream
native new  throws FileNotFoundException  overloads new
newβStringIO FileInputStream
native new  throws FileNotFoundException  overloads new
data Reader = mutable native java.io.Reader

Member Functions

getCharReaderIO Char

Read the next character from the input stream. Throws EOFException if the end of the stream has been reached, or IOException if an I/O error occurs.

readReaderIO Int
native read  throws IOException

Reads a single character and returns it as Int in the range 0 to 65535. Returns -1 if the end of the stream has been reached.

Throws IOException if an I/O error occurs.

data InputStreamReader = mutable native java.io.InputStreamReader

Member Functions

newInputStreamStringIO InputStreamReader
native new  throws UnsupportedEncodingException
data BufferedReader = mutable native java.io.BufferedReader

Member Functions

getLineBufferedReaderIO String

Reads the next line from a buffered reader using BufferedReader.readLine, and returns the string or throws EOFException on end of file.

getLinesBufferedReaderIO [String]

read all lines and return them as list, close reader afterwards

newReaderIO BufferedReader
native new
readLineBufferedReaderIO (Maybe String)
native readLine  throws IOException

Reads a line of text. A line is considered to be terminated by any one of a line feed ("\n"), a carriage return ("\r"), or a carriage return followed immediately by a linefeed.

Returns:
Maybe.Just string, where string is the contents of the line, not including any line-termination characters, or Maybe.Nothing if the end of the stream has been reached.
Throws:
IOException - If an I/O error occurs
openReaderStringIO BufferedReader

Convenience function to open a file and wrap it with an UTF-8 decoding buffered Reader.

May throw FileNotFoundException

openWriterStringIO PrintWriter

Convenience function to open a file for writing through an UTF-8 encoding PrintWriter.

May throw FileNotFoundException

appendWriterStringIO PrintWriter

Convenience function to open a file in append mode for writing through an UTF-8 encoding PrintWriter.

May throw FileNotFoundException

Instances

instance Exceptional EOFException

Member Functions

javaClassClass EOFException
pure native java.io.EOFException.class
instance Exceptional FileNotFoundException

Member Functions

javaClassClass FileNotFoundException
pure native java.io.FileNotFoundException.class
instance Exceptional UnsupportedEncodingException

Member Functions

javaClassClass UnsupportedEncodingException
pure native java.io.UnsupportedEncodingException.class
instance Serializable File

Member Functions

copySerializableFileFile
pure native frege.runtime.Runtime.copySerializable

inherited from Serializable.copySerializable

freezeFileFile

inherited from Serializable.freeze

thawFileFile

inherited from Serializable.thaw

instance Show File

Member Functions

displayFileString

inherited from Show.display

showFileString
showCharsFile → [Char]

inherited from Show.showChars

showList[File]StringString

inherited from Show.showList

showsPrecIntFileStringString

inherited from Show.showsPrec

showsubFileString

inherited from Show.showsub

Functions and Values by Type

MutableIO FileMutableIO FileIO Bool

File.renameTo

MutableIO FileStringIO PrintWriter

PrintWriter.newγ

MutableIO FileBoolIO FileOutputStream

FileOutputStream.newβ

MutableIO FileIO (Maybe (ArrayOf RealWorld String))

File.list

MutableIO FileIO (Maybe (MutableIO File))

File.getParentFile

MutableIO FileIO String

File.getPath, File.getName

MutableIO FileIO FileInputStream

FileInputStream.newα

MutableIO FileIO FileOutputStream

FileOutputStream.newα

MutableIO FileIO PrintWriter

PrintWriter.newβ

MutableIO FileIO Bool

File.isFile, File.isAbsolute, File.isDirectory, File.delete, File.exists, File.canRead, File.canWrite, File.mkdirs

MutableIO FileIO Long

File.lastModified

StringStringSTMutable RealWorld File

File.createTempFile

StringBoolIO FileOutputStream

FileOutputStream.newδ

StringIO BufferedReader

openReader

StringIO FileInputStream

FileInputStream.newβ

StringIO FileOutputStream

FileOutputStream.newγ

StringIO PrintWriter

appendWriter, openWriter, PrintWriter.newα

StringEOFException

EOFException.new

[File] → StringString

Show_File.showList

BufferedReaderIO (Maybe String)

BufferedReader.readLine

BufferedReaderIO String

BufferedReader.getLine

BufferedReaderIO [String]

BufferedReader.getLines

CloseableIO ()

Closeable.close

FileString

Show_File.showsub, Show_File.display, Show_File.show, File.getPathF

File → [Char]

Show_File.showChars

FileFile

Serializable_File.thaw, Serializable_File.copySerializable, Serializable_File.freeze

FileURI

File.toURI

FileOutputStreamIntIO ()

FileOutputStream.write

FlushableIO ()

Flushable.flush

InputStreamStringIO InputStreamReader

InputStreamReader.new

OutputStreamStringIO OutputStreamWriter

OutputStreamWriter.new

PrintWriterStringIO ()

PrintWriter.printlnα, PrintWriter.print

PrintWriterIO ()

PrintWriter.printlnβ

ReaderIO BufferedReader

BufferedReader.new

ReaderIO Char

Reader.getChar

ReaderIO Int

Reader.read

StringWriterIO String

StringWriter.toString

StringWriterIO PrintWriter

StringWriter.printer

WriterStringIntIntIO ()

Writer.writeγ

WriterStringIO ()

Writer.writeβ

WriterBoolIO PrintWriter

PrintWriter.newε

WriterCharIO ()

Writer.putChar

WriterIntIO ()

Writer.writeα

WriterIO PrintWriter

PrintWriter.newδ

()IO StringWriter

StringWriter.new

IntFileStringString

Show_File.showsPrec

Class EOFException

Exceptional_EOFException.javaClass

Class FileNotFoundException

Exceptional_FileNotFoundException.javaClass

Class UnsupportedEncodingException

Exceptional_UnsupportedEncodingException.javaClass

String

File.separator, File.pathSeparator

BufferedReader

stdin

PrintWriter

stderr, stdout

Mutable s FileStringSTMutable s File

File.newβ

StringSTMutable s File

File.newα

PrintWriterString → a → IO ()

PrintWriter.printfα

ω

File.new, FileInputStream.new, FileOutputStream.new, PrintWriter.println, PrintWriter.new, PrintWriter.printf, Writer.write

PrintWriterString → a → b → IO ()

PrintWriter.printfβ

PrintWriterString → a → b → c → IO ()

PrintWriter.printfγ

PrintWriterString → a → b → c → d → IO ()

PrintWriter.printfδ

PrintWriterString → a → b → c → d → e → IO ()

PrintWriter.printfε

PrintWriterString → a → b → c → d → e → f → IO ()

PrintWriter.printfζ

PrintWriterString → a → b → c → d → e → f → g → IO ()

PrintWriter.printfη

PrintWriterString → a → b → c → d → e → f → g → h → IO ()

PrintWriter.printfθ

PrintWriterString → a → b → c → d → e → f → g → h → i → IO ()

PrintWriter.printfι

Valid HTML 4.01 Strict