- Java.io - Writer
- Java.io - StringWriter
- Java.io - StringReader
- Java.io - StringBufferInputStream
- Java.io - StreamTokenizer
- Java.io - SerializablePermission
- Java.io - SequenceInputStream
- Java.io - Reader
- Java.io - RandomAccessFile
- Java.io - PushbackReader
- Java.io - PushbackInputStream
- Java.io - PrintWriter
- Java.io - PrintStream
- Java.io - PipedWriter
- Java.io - PipedReader
- Java.io - PipedOutputStream
- Java.io - PipedInputStream
- Java.io - OutputStreamWriter
- Java.io - OutputStream
- Java.io - ObjectStreamField
- Java.io - ObjectStreamClass
- io - ObjectOutputStream.PutField
- Java.io - ObjectOutputStream
- Java.io - ObjectInputStream.GetField
- Java.io - ObjectInputStream
- Java.io - LineNumberReader
- Java.io - LineNumberInputStream
- Java.io - InputStreamReader
- Java.io - InputStream
- Java.io - FilterWriter
- Java.io - FilterReader
- Java.io - FilterOutputStream
- Java.io - FilterInputStream
- Java.io - FileWriter
- Java.io - FileReader
- Java.io - FilePermission
- Java.io - FileOutputStream
- Java.io - FileInputStream
- Java.io - FileDescriptor
- Java.io - File
- Java.io - DataOutputStream
- Java.io - DataInputStream
- Java.io - Console
- Java.io - CharArrayWriter
- Java.io - CharArrayReader
- Java.io - ByteArrayOutputStream
- Java.io - ByteArrayInputStream
- Java.io - BufferedWriter
- Java.io - BufferedReader
- Java.io - BufferedOutputStream
- Java.io - BufferedInputStream
- Java.io - Home
Java.io package extras
Java.io package Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.io.DataInputStream Class
Introduction
The Java.io.DataInputStream class lets an apppcation read primitive Java data types from an underlying input stream in a machine-independent way.Following are the important points about DataInputStream −
An apppcation uses a data output stream to write data that can later be read by a data input stream.
DataInputStream is not necessarily safe for multithreaded access. Thread safety is optional and is the responsibipty of users of methods in this class.
Class declaration
Following is the declaration for Java.io.DataInputStream class −
pubpc class DataInputStream extends FilterInputStream implements DataInput
Field
Following are the fields for Java.io.DataInputStream class −
protected InputStream in − This is the input stream to be filtered.
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 | DataInputStream(InputStream in) This creates a DataInputStream that uses the specified underlying InputStream. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method reads some number of bytes from the contained input stream and stores them into the buffer array b |
2 | This method reads up to len bytes of data from the contained input stream into an array of bytes. |
3 | This method reads one input byte and returns true if that byte is nonzero, false if that byte is zero. |
4 | This method reads and returns one input byte. |
5 | This method reads two input bytes and returns a char value. |
6 | This method reads eight input bytes and returns a double value. |
7 | This method reads four input bytes and returns a float value. |
8 | This method reads some bytes from an input stream and stores them into the buffer array b. |
9 | This method reads len bytes from an input stream. |
10 | This method reads four input bytes and returns an int value. |
11 | This method reads eight input bytes and returns a long value. |
12 | This method reads two input bytes and returns a short value. |
13 | This method reads one input byte, zero-extends it to type int, and returns the result, which is therefore in the range 0 through 255. |
14 | This method reads two input bytes and returns an int value in the range 0 through 65535. |
15 | This method reads in a string that has been encoded using a modified UTF-8 format. |
16 | This method 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. |
17 | This method makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes. |
Methods inherited
This class inherits methods from the following classes −
Java.io.FilterInputStream
Java.io.Object