I/O Classes (java.io)
File access from applications must not be used because of performance and security problems. There are several problems related to file access from servlets, portal applications or EJBs:
· Files access is a bottleneck in terms of scalability and performance and is amplified when accessing files on network shares. There is no pooling and no caching available and the number of concurrently open files is usually restricted.
· Files access bares a potential security risk because it has no built-in authorization concept like there is with true J2EE resources (for example, JNDI).
· Files are not transactional and therefore only suitable for static information like configuration settings. For these types of data, better facilities are offered by the portal, for example, profiles.

The JLin rule File Accessfinds code sections that implement access to files.
For better performance, byte/character data should always be transferred in chunks. Operating systems use block wise I/O for transfers (files, network), therefore byte-per-byte access will multiply the overhead generated by Java. When byte wise access is required, the use of buffering wrappers (BufferedWriter, BufferedReader, BufferedInputStream, BufferedOutputStream) is mandatory.
The operating system usually limits the number of I/O related resources, because even inactive resources put load on a system. Therefore the garbage collection mechanisms (finalization) offered by Java are not adequate for the management of operating system resources. In order to prevent shortages it is necessary to explicitly release these resources using dedicated methods (often named close).
The following classes represent resources that should be released explicitly:
· InputStream (except for ByteArrayInputStream)
· OutputStream (except for ByteArrayOutputStream)
· Reader (except for StringReader)
· Writer (except for StringWriter)
· Connection
For deeper coverage, see Resource Management.

Use JLin Rule Release of Resources to automatically detect suspicious code sections.