std.io

Function Description

The io package provides the capability of data exchange between a program and an external device.

I/O operation refers to an operation of exchanging data between a program and an external device. Cangjie provides universal interfaces and some special implementations for streaming I/O operations. An input or output stream is similar to a data channel and carries a segment of ordered data. A program reads data (from a file or network) in the input stream and writes data to the output stream (to a file or network).

API List

Function

NameDescription
copy(InputStream, OutputStream)Copies the data that is not read from an input stream to another output stream.
readString<T>(T) where T <: InputStream & SeekableReads the remaining content in the input parameter and returns a string.
readStringUnchecked<T>(T) where T <: InputStream & SeekableReads the remaining content in the input parameter and returns a string. This function does not check the validity of strings.
func readToEnd<T>(T) where T <: InputStream & SeekableObtains the data that is not read from the input parameter.

Interface

NameDescription
InputStreamSpecifies input stream interface.
IOStreamSpecifies input and output stream interface.
OutputStreamSpecifies output stream interface.
SeekableMoves the cursor.

Class

NameDescription
BufferedInputStream<T> where T <: InputStreamProvides input streams with buffers.
BufferedOutputStream<T> where T <: OutputStreamProvides output streams with buffers.
ByteBufferInput stream interface.
ChainedInputStream<T> where T <: InputStreamReads data from the InputStream array in sequence.
MultiOutputStream<T> where T <: OutputStreamWrites data to each output stream in the OutputStream array at the same time.
StringReader<T> where T <: InputStreamReads data from the InputStream input stream and converts the data into characters or a string.
StringWriter<T> where T <: OutputStreamConverts strings and some ToString types to strings in a specified encoding format and byte order and writes the strings to the output stream.

Enumeration

NameDescription
SeekPositionInput stream interface.

Exception Class

NameDescription
ContentFormatExceptionHandles exceptions related to character formats.
IOExceptionHandles exceptions related to I/O streams.