View RSS Feed

Streams

Java Streams

  1. Random Access File

    by , 11-11-2011 at 06:38 PM (My Java Tips)
    Instances of this class support both reading and writing to a random access file. A random access file behaves like a large array of bytes stored in the file system. There is a kind of cursor, or index into the implied array, called the file pointer; input operations read bytes starting at the file pointer and advance the file pointer past the bytes read. If the random access file is created in read/write mode, then output operations are also available; output operations write bytes starting at ...
  2. Data Streams

    by , 11-11-2011 at 06:35 PM (My Java Tips)
    Data streams support binary I/O of primitive data type values (boolean, char, byte, short, int, long, float, and double) as well as String values. All data streams implement either the DataInput interface or the DataOutput interface.


    If you need to work with data that is not represented as bytes or characters then you can use Data Streams. These streams filter an existing byte stream so that each primitive data types can be read from or written to the stream directly.

    ...
  3. Buffered Streams

    by , 11-11-2011 at 06:33 PM (My Java Tips)
    When we use unbuffered I/O, each read or write request is handled directly by the underlying OS. This can make a program much less efficient, since each such request often triggers disk access, network activity, or some other operation that is relatively expensive. To reduce this kind of overhead, the Java platform implements buffered I/O streams.


    Class BufferedReader reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, ...
    Categories
    Streams
  4. Character Streams

    by , 11-11-2011 at 06:31 PM (My Java Tips)
    Character Streams handle I/O of character data, automatically handling translation to and from the local character set. All character stream classes are descended from Reader and Writer. As with byte streams, there are character stream classes that specialize in file I/O: FileReader and FileWriter. The Java platform stores character values using Unicode conventions Character stream I/O automatically translates this internal format to and from the local character set. In Western locales, the local ...
  5. Byte Streams

    by , 11-11-2011 at 06:27 PM (My Java Tips)
    Java IO programs use byte streams to perform input and output of 8-bit bytes. All byte stream classes are descended from InputStream and OutputStream.


    There are many byte stream classes. To demonstrate how byte streams work, we'll focus on the file I/O byte streams, FileInputStream and FileOutputStream. Other kinds of byte streams are used in much the same way; they differ mainly in the way they are constructed.

    A FileInputStream obtains input bytes from a file in a ...
    Tags: byte, java io, streams Add / Edit Tags
    Categories
    Streams