Troubleshooting

Understanding the Use of the File Class

Whenever I create a File instance, I can't figure out how to read or write to the file.

The File class represents a filename, not an actual file object. It is really immutable. To read or write, you will need to use one of the stream classes or the reader /writer classes. The File classes can be used for certain operations such as renaming a file.

Using the available() Method

When I use the available() method on the InputStream class, it does not return the correct number that I expect.

The available() method does not necessarily guaranteed to return the maximum number of bytes available without blocking.

Exceptions Thrown by the PrintStream and PrintWriter Classes ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.