Level 92 Level 94
Level 93

[No Typing] Files


28 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

Ignore?
java.io
package contains nearly every class you might ever need to perform input and output (I/O) in Java.
stream
a sequence of data
InPutStream
the InputStream is used to read data from a source
OutPutStream
the OutputStream is used for writing data to a destination.
Standard Input
This is used to feed the data to user's program and usually a keyboard is used as standard input stream and represented as System.in.
Standard Output
This is used to output the data produced by the user's program and usually a computer screen is used to standard output stream and represented as System.out.
Standard Error
This is used to output the error data produced by the user's program and usually a computer screen is used to standard error stream and represented as System.err.
FileInputStream
stream is used for reading data from the files
public void close() throws IOException{}
This method closes the file output stream. Releases any system resources associated with the file. Throws an IOException.
ByteArrayInputStream
allows a buffer in the memory to be used as an InputStream
ByteArrayInputStream(byte [] a)
This constructor accepts a byte array as parameter.
public int read()
This method reads the next byte of data from the InputStream. Returns an int as the next byte of data. If it is end of file then it returns -1.
public int available()
Gives the number of bytes that can be read from this file input stream. Returns an int that gives the number of bytes to be read.
public void mark(int read)
This sets the current marked position in the stream. the parameter gives the maximum limit of bytes that can be read before the marked position becomes invalid.
public long skip(long n)
Skips n number of bytes from the stream. This returns the actual number of bytes skipped.
FileOutputStream
used to create a file and write data into it
public void close() throws IOException{}
This method closes the file output stream. Releases any system resources associated with the file. Throws an IOException
public void write(byte[] w)
Writes w.length bytes from the mentioned byte array to the OutputStream.
ByteArrayOutputStream class stream
creates a buffer in memory and all the data sent to the stream is stored in the buffer.
ByteArrayOutputStream()
This constructor creates a ByteArrayOutputStream having buffer of 32 byte
ByteArrayOutputStream(int a)
This constructor creates a ByteArrayOutputStream having buffer of the given size
public void reset()
This method resets the number of valid bytes of the byte array output stream to zero, so all the accumulated output in the stream will be discarded.
public byte[] toByteArray()
This method creates a newly allocated Byte array.
public String toString()
Converts the buffer content into a string. Translation will be done according to the default character encoding. Returns the String translated from the buffer's content.
public void write(int w)
Writes the specified array to the output stream.
public void writeTo(OutputStream outSt)
Writes the entire content of this Stream to the specified stream argument.
DataOutputStream stream
let you write the primitives to an output source.
Public void flush()throws IOException
Flushes the data output stream.