Package | Description |
---|---|
java.io |
Provides for system input and output through data streams and the file system.
|
java.lang |
Provides classes that are fundamental to the design of the Java
programming language.
|
java.net |
Provides exceptions related to socket connections.
|
java.nio.channels |
Defines channels, which represent connections to entities that are capable of
performing I/O operations, such as files.
|
java.nio.file |
Defines interfaces and classes for the Java virtual machine to access files,
file attributes, and file systems.
|
java.util |
Contains the collections framework, legacy collection classes, event model,
date and time facilities, random-number generator, and miscellaneous utility
classes.
|
Modifier and Type | Class and Description |
---|---|
class |
EOFException
Signals that an end of file or end of stream has been reached
unexpectedly during input.
|
class |
InterruptedIOException
Signals that an I/O operation has been interrupted.
|
class |
UnsupportedEncodingException
The Character Encoding is not supported.
|
class |
UTFDataFormatException
Signals that a malformed string in
modified UTF-8
format has been read in a data
input stream or by any class that implements the data input
interface.
|
Modifier and Type | Method and Description |
---|---|
Writer |
Writer.append(char c)
Appends the specified character to this writer.
|
Writer |
Writer.append(CharSequence csq)
Appends the specified character sequence to this writer.
|
Writer |
Writer.append(CharSequence csq,
int start,
int end)
Appends a subsequence of the specified character sequence to this writer.
|
int |
InputStream.available()
Returns an estimate of the number of bytes that can be read (or
skipped over) from this input stream without blocking by the next
invocation of a method for this input stream.
|
int |
DataInputStream.available()
Returns an estimate of the number of bytes that can be read (or
skipped over) from this input stream without blocking by the next
caller of a method for this input stream.
|
abstract void |
Writer.close()
Closes the stream, flushing it first.
|
abstract void |
Reader.close()
Closes the stream and releases any system resources associated with
it.
|
void |
OutputStreamWriter.close() |
void |
OutputStream.close()
Closes this output stream and releases any system resources
associated with this stream.
|
void |
InputStreamReader.close() |
void |
InputStream.close()
Closes this input stream and releases any system resources associated
with the stream.
|
void |
DataOutputStream.close()
Closes this output stream and releases any system resources
associated with the stream.
|
void |
DataInputStream.close()
Closes this input stream and releases any system resources
associated with the stream.
|
void |
Closeable.close()
Closes this stream and releases any system resources associated
with it.
|
void |
ByteArrayOutputStream.close()
Closing a ByteArrayOutputStream has no effect.
|
void |
ByteArrayInputStream.close()
Closing a ByteArrayInputStream has no effect.
|
void |
BufferedWriter.close() |
void |
BufferedReader.close() |
abstract void |
Writer.flush()
Flushes the stream.
|
void |
OutputStreamWriter.flush()
Flushes the stream.
|
void |
OutputStream.flush()
Flushes this output stream and forces any buffered output bytes
to be written out.
|
void |
DataOutputStream.flush()
Flushes this data output stream.
|
void |
BufferedWriter.flush()
Flushes the stream.
|
void |
Reader.mark(int readAheadLimit)
Marks the present position in the stream.
|
void |
BufferedReader.mark(int readAheadLimit)
Marks the present position in the stream.
|
void |
BufferedWriter.newLine()
Writes a line separator.
|
int |
Reader.read()
Reads a single character.
|
int |
InputStreamReader.read()
Reads a single character.
|
abstract int |
InputStream.read()
Reads the next byte of data from the input stream.
|
int |
DataInputStream.read()
Reads the next byte of data from this input stream.
|
int |
BufferedReader.read()
Reads a single character.
|
int |
InputStream.read(byte[] b)
Reads some number of bytes from the input stream and stores them into
the buffer array
b . |
int |
DataInputStream.read(byte[] b)
Reads some number of bytes from the contained input stream and
stores them into the buffer array
b . |
int |
InputStream.read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the input stream into
an array of bytes. |
int |
DataInputStream.read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the contained
input stream into an array of bytes. |
int |
Reader.read(char[] cbuf)
Reads characters into an array.
|
abstract int |
Reader.read(char[] cbuf,
int off,
int len)
Reads characters into a portion of an array.
|
int |
InputStreamReader.read(char[] cbuf,
int offset,
int length)
Reads characters into a portion of an array.
|
int |
BufferedReader.read(char[] cbuf,
int off,
int len)
Reads characters into a portion of an array.
|
boolean |
DataInputStream.readBoolean()
See the general contract of the
readBoolean
method of DataInput . |
boolean |
DataInput.readBoolean()
Reads one input byte and returns
true if that byte is nonzero,
false if that byte is zero. |
byte |
DataInputStream.readByte()
See the general contract of the
readByte
method of DataInput . |
byte |
DataInput.readByte()
Reads and returns one input byte.
|
char |
DataInputStream.readChar()
See the general contract of the
readChar
method of DataInput . |
char |
DataInput.readChar()
Reads two input bytes and returns a
char value. |
double |
DataInputStream.readDouble()
See the general contract of the
readDouble
method of DataInput . |
double |
DataInput.readDouble()
Reads eight input bytes and returns
a
double value. |
float |
DataInputStream.readFloat()
See the general contract of the
readFloat
method of DataInput . |
float |
DataInput.readFloat()
Reads four input bytes and returns
a
float value. |
void |
DataInputStream.readFully(byte[] b)
See the general contract of the
readFully
method of DataInput . |
void |
DataInput.readFully(byte[] b)
Reads some bytes from an input
stream and stores them into the buffer
array
b . |
void |
DataInputStream.readFully(byte[] b,
int off,
int len)
See the general contract of the
readFully
method of DataInput . |
void |
DataInput.readFully(byte[] b,
int off,
int len)
Reads
len
bytes from
an input stream. |
int |
DataInputStream.readInt()
See the general contract of the
readInt
method of DataInput . |
int |
DataInput.readInt()
Reads four input bytes and returns an
int value. |
String |
BufferedReader.readLine()
Reads a line of text.
|
long |
DataInputStream.readLong()
See the general contract of the
readLong
method of DataInput . |
long |
DataInput.readLong()
Reads eight input bytes and returns
a
long value. |
short |
DataInputStream.readShort()
See the general contract of the
readShort
method of DataInput . |
short |
DataInput.readShort()
Reads two input bytes and returns
a
short value. |
int |
DataInputStream.readUnsignedByte()
See the general contract of the
readUnsignedByte
method of DataInput . |
int |
DataInput.readUnsignedByte()
Reads one input byte, zero-extends
it to type
int , and returns
the result, which is therefore in the range
0
through 255 . |
int |
DataInputStream.readUnsignedShort()
See the general contract of the
readUnsignedShort
method of DataInput . |
int |
DataInput.readUnsignedShort()
Reads two input bytes and returns
an
int value in the range 0
through 65535 . |
String |
DataInputStream.readUTF()
See the general contract of the
readUTF
method of DataInput . |
String |
DataInput.readUTF()
Reads in a string that has been encoded using a
modified UTF-8
format.
|
static String |
DataInputStream.readUTF(DataInput in)
Reads from the
stream
in a representation
of a Unicode character string encoded in
modified UTF-8 format;
this string of characters is then returned as a String . |
boolean |
Reader.ready()
Tells whether this stream is ready to be read.
|
boolean |
InputStreamReader.ready()
Tells whether this stream is ready to be read.
|
boolean |
BufferedReader.ready()
Tells whether this stream is ready to be read.
|
void |
Reader.reset()
Resets the stream.
|
void |
InputStream.reset()
Repositions this stream to the position at the time the
mark method was last called on this input stream. |
void |
DataInputStream.reset()
Repositions this stream to the position at the time the
mark method was last called on this input stream. |
void |
BufferedReader.reset()
Resets the stream to the most recent mark.
|
long |
Reader.skip(long n)
Skips characters.
|
long |
InputStream.skip(long n)
Skips over and discards
n bytes of data from this input
stream. |
long |
DataInputStream.skip(long n)
Skips over and discards
n bytes of data from this input
stream. |
long |
BufferedReader.skip(long n)
Skips characters.
|
int |
DataInputStream.skipBytes(int n)
See the general contract of the
skipBytes
method of DataInput . |
int |
DataInput.skipBytes(int n)
Makes an attempt to skip over
n bytes
of data from the input
stream, discarding the skipped bytes. |
void |
OutputStream.write(byte[] b)
Writes
b.length bytes from the specified byte array
to this output stream. |
void |
DataOutputStream.write(byte[] b)
Writes
b.length bytes to this output stream. |
void |
DataOutput.write(byte[] b)
Writes to the output stream all the bytes in array
b . |
void |
OutputStream.write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off to this output stream. |
void |
DataOutputStream.write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off to the underlying output stream. |
void |
DataOutput.write(byte[] b,
int off,
int len)
Writes
len bytes from array
b , in order, to
the output stream. |
void |
Writer.write(char[] cbuf)
Writes an array of characters.
|
abstract void |
Writer.write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
void |
OutputStreamWriter.write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
void |
BufferedWriter.write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
void |
Writer.write(int c)
Writes a single character.
|
void |
OutputStreamWriter.write(int c)
Writes a single character.
|
abstract void |
OutputStream.write(int b)
Writes the specified byte to this output stream.
|
void |
DataOutputStream.write(int b)
Writes the specified byte (the low eight bits of the argument
b ) to the underlying output stream. |
void |
DataOutput.write(int b)
Writes to the output stream the eight
low-order bits of the argument
b . |
void |
BufferedWriter.write(int c)
Writes a single character.
|
void |
Writer.write(String str)
Writes a string.
|
void |
Writer.write(String str,
int off,
int len)
Writes a portion of a string.
|
void |
OutputStreamWriter.write(String str,
int off,
int len)
Writes a portion of a string.
|
void |
BufferedWriter.write(String s,
int off,
int len)
Writes a portion of a String.
|
void |
DataOutputStream.writeBoolean(boolean v)
Writes a
boolean to the underlying output stream as
a 1-byte value. |
void |
DataOutput.writeBoolean(boolean v)
Writes a
boolean value to this output stream. |
void |
DataOutputStream.writeByte(int v)
Writes out a
byte to the underlying output stream as
a 1-byte value. |
void |
DataOutput.writeByte(int v)
Writes to the output stream the eight low-
order bits of the argument
v . |
void |
DataOutputStream.writeBytes(String s)
Writes out the string to the underlying output stream as a
sequence of bytes.
|
void |
DataOutput.writeBytes(String s)
Writes a string to the output stream.
|
void |
DataOutputStream.writeChar(int v)
Writes a
char to the underlying output stream as a
2-byte value, high byte first. |
void |
DataOutput.writeChar(int v)
Writes a
char value, which
is comprised of two bytes, to the
output stream. |
void |
DataOutputStream.writeChars(String s)
Writes a string to the underlying output stream as a sequence of
characters.
|
void |
DataOutput.writeChars(String s)
Writes every character in the string
s ,
to the output stream, in order,
two bytes per character. |
void |
DataOutputStream.writeDouble(double v)
Converts the double argument to a
long using the
doubleToLongBits method in class Double ,
and then writes that long value to the underlying
output stream as an 8-byte quantity, high byte first. |
void |
DataOutput.writeDouble(double v)
Writes a
double value,
which is comprised of eight bytes, to the output stream. |
void |
DataOutputStream.writeFloat(float v)
Converts the float argument to an
int using the
floatToIntBits method in class Float ,
and then writes that int value to the underlying
output stream as a 4-byte quantity, high byte first. |
void |
DataOutput.writeFloat(float v)
Writes a
float value,
which is comprised of four bytes, to the output stream. |
void |
DataOutputStream.writeInt(int v)
Writes an
int to the underlying output stream as four
bytes, high byte first. |
void |
DataOutput.writeInt(int v)
Writes an
int value, which is
comprised of four bytes, to the output stream. |
void |
DataOutputStream.writeLong(long v)
Writes a
long to the underlying output stream as eight
bytes, high byte first. |
void |
DataOutput.writeLong(long v)
Writes a
long value, which is
comprised of eight bytes, to the output stream. |
void |
DataOutputStream.writeShort(int v)
Writes a
short to the underlying output stream as two
bytes, high byte first. |
void |
DataOutput.writeShort(int v)
Writes two bytes to the output
stream to represent the value of the argument.
|
void |
ByteArrayOutputStream.writeTo(OutputStream out)
Writes the complete contents of this byte array output stream to
the specified output stream argument, as if by calling the output
stream's write method using
out.write(buf, 0, count) . |
void |
DataOutputStream.writeUTF(String str)
Writes a string to the underlying output stream using
modified UTF-8
encoding in a machine-independent manner.
|
void |
DataOutput.writeUTF(String s)
Writes two bytes of length information
to the output stream, followed
by the
modified UTF-8
representation
of every character in the string
s . |
Modifier and Type | Method and Description |
---|---|
Appendable |
Appendable.append(char c)
Appends the specified character to this Appendable.
|
Appendable |
Appendable.append(CharSequence csq)
Appends the specified character sequence to this Appendable.
|
Appendable |
Appendable.append(CharSequence csq,
int start,
int end)
Appends a subsequence of the specified character sequence to this
Appendable.
|
Modifier and Type | Class and Description |
---|---|
class |
BindException
Signals that an error occurred while attempting to bind a
socket to a local address and port.
|
class |
ConnectException
Signals that an error occurred while attempting to connect a
socket to a remote address and port.
|
class |
NoRouteToHostException
Signals that an error occurred while attempting to connect a
socket to a remote address and port.
|
class |
PortUnreachableException
Signals that an ICMP Port Unreachable message has been
received on a connected datagram.
|
class |
SocketException
Thrown to indicate that there is an error creating or accessing a Socket.
|
class |
UnknownHostException
Thrown to indicate that the IP address of a host could not be determined.
|
Modifier and Type | Class and Description |
---|---|
class |
AsynchronousCloseException
Checked exception received by a thread when another thread closes the
channel or the part of the channel upon which it is blocked in an I/O
operation.
|
class |
ClosedByInterruptException
Checked exception received by a thread when another thread interrupts it
while it is blocked in an I/O operation upon a channel.
|
class |
ClosedChannelException
Checked exception thrown when an attempt is made to invoke or complete an
I/O operation upon channel that is closed, or at least closed to that
operation.
|
Modifier and Type | Method and Description |
---|---|
void |
Channel.close()
Closes this channel.
|
abstract void |
FileChannel.force(boolean metaData)
Forces any updates to this channel's file to be written to the storage
device that contains it.
|
static FileChannel |
FileChannel.open(Path path,
OpenOption... options)
Opens or creates a file, returning a file channel to access the file.
|
static FileChannel |
FileChannel.open(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
Opens or creates a file, returning a file channel to access the file.
|
long |
SeekableByteChannel.position()
Returns this channel's position.
|
abstract long |
FileChannel.position()
Returns this channel's file position.
|
SeekableByteChannel |
SeekableByteChannel.position(long newPosition)
Sets this channel's position.
|
abstract FileChannel |
FileChannel.position(long newPosition)
Sets this channel's file position.
|
int |
SeekableByteChannel.read(ByteBuffer dst)
Reads a sequence of bytes from this channel into the given buffer.
|
int |
ReadableByteChannel.read(ByteBuffer dst)
Reads a sequence of bytes from this channel into the given buffer.
|
abstract int |
FileChannel.read(ByteBuffer dst)
Reads a sequence of bytes from this channel into the given buffer.
|
abstract int |
FileChannel.read(ByteBuffer dst,
long position)
Reads a sequence of bytes from this channel into the given buffer,
starting at the given file position.
|
long |
SeekableByteChannel.size()
Returns the current size of entity to which this channel is connected.
|
abstract long |
FileChannel.size()
Returns the current size of this channel's file.
|
SeekableByteChannel |
SeekableByteChannel.truncate(long size)
Truncates the entity, to which this channel is connected, to the given
size.
|
abstract FileChannel |
FileChannel.truncate(long size)
Truncates this channel's file to the given size.
|
int |
WritableByteChannel.write(ByteBuffer src)
Writes a sequence of bytes to this channel from the given buffer.
|
int |
SeekableByteChannel.write(ByteBuffer src)
Writes a sequence of bytes to this channel from the given buffer.
|
abstract int |
FileChannel.write(ByteBuffer src)
Writes a sequence of bytes to this channel from the given buffer.
|
abstract int |
FileChannel.write(ByteBuffer src,
long position)
Writes a sequence of bytes to this channel from the given buffer,
starting at the given file position.
|
Modifier and Type | Class and Description |
---|---|
class |
AtomicMoveNotSupportedException
Checked exception thrown when a file cannot be moved as an atomic file system
operation.
|
class |
DirectoryNotEmptyException
Checked exception thrown when a file system operation fails because a
directory is not empty.
|
class |
FileAlreadyExistsException
Checked exception thrown when an attempt is made to create a file or
directory and a file of that name already exists.
|
class |
FileSystemException
Thrown when a file system operation fails on one or two files.
|
class |
NoSuchFileException
Checked exception thrown when an attempt is made to access a file that does
not exist.
|
class |
NotDirectoryException
Checked exception thrown when a file system operation, intended for a
directory, fails because the file is not a directory.
|
Modifier and Type | Method and Description |
---|---|
IOException |
DirectoryIteratorException.getCause()
Returns the cause of this exception.
|
Modifier and Type | Method and Description |
---|---|
boolean |
DirectoryStream.Filter.accept(T entry)
Decides if the given directory entry should be accepted or filtered.
|
abstract void |
FileSystem.close()
Closes this file system.
|
static Path |
Files.copy(Path source,
Path target,
CopyOption... options)
Copy a file to a target file.
|
static Path |
Files.createDirectories(Path dir,
FileAttribute<?>... attrs)
Creates a directory by creating all nonexistent parent directories first.
|
static Path |
Files.createDirectory(Path dir,
FileAttribute<?>... attrs)
Creates a new directory.
|
static Path |
Files.createFile(Path path,
FileAttribute<?>... attrs)
Creates a new and empty file, failing if the file already exists.
|
static Path |
Files.createTempDirectory(Path dir,
String prefix,
FileAttribute<?>... attrs)
Creates a new directory in the specified directory, using the given
prefix to generate its name.
|
static Path |
Files.createTempDirectory(String prefix,
FileAttribute<?>... attrs)
Creates a new directory in the default temporary-file directory, using
the given prefix to generate its name.
|
static Path |
Files.createTempFile(Path dir,
String prefix,
String suffix,
FileAttribute<?>... attrs)
Creates a new empty file in the specified directory, using the given
prefix and suffix strings to generate its name.
|
static Path |
Files.createTempFile(String prefix,
String suffix,
FileAttribute<?>... attrs)
Creates an empty file in the default temporary-file directory, using
the given prefix and suffix to generate its name.
|
static void |
Files.delete(Path path)
Deletes a file.
|
static boolean |
Files.deleteIfExists(Path path)
Deletes a file if it exists.
|
static Object |
Files.getAttribute(Path path,
String attribute,
LinkOption... options)
Reads the value of a file attribute.
|
abstract Object |
FileStore.getAttribute(String attribute)
Reads the value of a file store attribute.
|
static FileStore |
Files.getFileStore(Path path)
Returns the
FileStore representing the file store where a file
is located. |
static FileTime |
Files.getLastModifiedTime(Path path,
LinkOption... options)
Returns a file's last modified time.
|
abstract long |
FileStore.getTotalSpace()
Returns the size, in bytes, of the file store.
|
abstract long |
FileStore.getUnallocatedSpace()
Returns the number of unallocated bytes in the file store.
|
abstract long |
FileStore.getUsableSpace()
Returns the number of bytes available to this Java virtual machine on the
file store.
|
static boolean |
Files.isHidden(Path path)
Tells whether or not a file is considered hidden.
|
static boolean |
Files.isSameFile(Path path,
Path path2)
Tests if two paths locate the same file.
|
static Path |
Files.move(Path source,
Path target,
CopyOption... options)
Move or rename a file to a target file.
|
static SeekableByteChannel |
Files.newByteChannel(Path path,
OpenOption... options)
Opens or creates a file, returning a seekable byte channel to access the
file.
|
static SeekableByteChannel |
Files.newByteChannel(Path path,
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
Opens or creates a file, returning a seekable byte channel to access the
file.
|
static DirectoryStream<Path> |
Files.newDirectoryStream(Path dir)
Opens a directory, returning a
DirectoryStream to iterate over
all entries in the directory. |
static DirectoryStream<Path> |
Files.newDirectoryStream(Path dir,
DirectoryStream.Filter<? super Path> filter)
Opens a directory, returning a
DirectoryStream to iterate over
the entries in the directory. |
static InputStream |
Files.newInputStream(Path path,
OpenOption... options)
Opens a file, returning an input stream to read from the file.
|
static OutputStream |
Files.newOutputStream(Path path,
OpenOption... options)
Opens or creates a file, returning an output stream that may be used to
write bytes to the file.
|
static <A extends BasicFileAttributes> |
Files.readAttributes(Path path,
Class<A> type,
LinkOption... options)
Reads a file's attributes as a bulk operation.
|
static Path |
Files.setAttribute(Path path,
String attribute,
Object value,
LinkOption... options)
Sets the value of a file attribute.
|
static Path |
Files.setLastModifiedTime(Path path,
FileTime time)
Updates a file's last modified time attribute.
|
static long |
Files.size(Path path)
Returns the size of a file (in bytes).
|
Path |
Path.toRealPath(LinkOption... options)
Returns the real path of an existing file.
|
Constructor and Description |
---|
DirectoryIteratorException(IOException cause)
Constructs an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
IOException |
Formatter.ioException()
Returns the
IOException last thrown by this formatter's Appendable . |
Modifier and Type | Method and Description |
---|---|
void |
Properties.load(InputStream inStream)
Reads a property list (key and element pairs) from the input
byte stream.
|
void |
Properties.load(Reader reader)
Reads a property list (key and element pairs) from the input
character stream in a simple line-oriented format.
|
void |
Properties.store(OutputStream out,
String comments)
Writes this property list (key and element pairs) in this
Properties table to the output stream in a format suitable
for loading into a Properties table using the
load(InputStream) method. |
void |
Properties.store(Writer writer,
String comments)
Writes this property list (key and element pairs) in this
Properties table to the output character stream in a
format suitable for using the load(Reader)
method. |
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.