Package kotlin.io
IO API for working with files and streams.
Types
FileWalkDirection
An enumeration to describe possible walk directions. There are two of them: beginning from parents, ending with children, and beginning from children, ending with parents. Both use depth-first search.
enum class FileWalkDirection
OnErrorAction
Enum that can be used to specify behaviour of the copyRecursively()
function
in exceptional conditions.
enum class OnErrorAction
Exceptions
AccessDeniedException
An exception class which is used when we have not enough access for some operation.
class AccessDeniedException : FileSystemException
FileAlreadyExistsException
An exception class which is used when some file to create or copy to already exists.
class FileAlreadyExistsException : FileSystemException
FileSystemException
A base exception class for file system exceptions.
open class FileSystemException : IOException
NoSuchFileException
An exception class which is used when file to copy does not exist.
class NoSuchFileException : FileSystemException
Extensions for External Classes
Properties
DEFAULT_BUFFER_SIZE
Returns the default buffer size when working with buffered streams.
const val DEFAULT_BUFFER_SIZE: Int
Functions
byteInputStream
Creates a new byte input stream for the string.
fun String.byteInputStream(
charset: Charset = Charsets.UTF_8
): ByteArrayInputStream
inputStream
Creates an input stream for reading data from this byte array.
fun ByteArray.inputStream(): ByteArrayInputStream
Creates an input stream for reading data from the specified portion of this byte array.
fun ByteArray.inputStream(
offset: Int,
length: Int
): ByteArrayInputStream
Prints the given message to the standard output stream.
fun print(message: Int)
fun print(message: Long)
fun print(message: Byte)
fun print(message: Short)
fun print(message: Char)
fun print(message: Boolean)
fun print(message: Float)
fun print(message: Double)
fun print(message: CharArray)
fun print(message: String)
fun print(message: Any?)
println
Prints the given message and the line separator to the standard output stream.
fun println(message: Int)
fun println(message: Long)
fun println(message: Byte)
fun println(message: Short)
fun println(message: Char)
fun println(message: Boolean)
fun println(message: Float)
fun println(message: Double)
fun println(message: CharArray)
fun println(message: String)
fun println(message: Any?)
Prints the line separator to the standard output stream.
fun println()
reader
Creates a new reader for the string.
fun String.reader(): StringReader
readLine
Reads a line of input from the standard input stream.
fun readLine(): String?