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

I'm using a PrintStream or a PrintWriter and even though there's no problem, they are not throwing exceptions.

Both the PrintStream and PrintWriter classes will not throw any exceptions. You must check for errors by calling the checkError method.

   


Special Edition Using Java 2 Standard Edition
Special Edition Using Java 2, Standard Edition (Special Edition Using...)
ISBN: 0789724685
EAN: 2147483647
Year: 1999
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net