- 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.DataOutputStream Class
Introduction
The Java.io.DataOutputStream class lets an apppcation write primitive Java data types to an output stream in a portable way. An apppcation can then use a data input stream to read the data back in.
Class declaration
Following is the declaration for Java.io.DataOutputStream class −
pubpc class DataOutputStream extends FilterOutputStream implements DataOutput
Field
Following are the fields for Java.io.DataOutputStream class −
protected int written − This is the number of bytes written to the data output stream so far.
protected OutputStream out − This is the underlying output stream to be filtered.
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 | DataOutputStream(OutputStream out) This creates a new data output stream to write data to the specified underlying output stream. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method flushes this data output stream. |
2 | This method returns the current value of the counter written, the number of bytes written to this data output stream so far. |
3 | This method writes len bytes from the specified byte array starting at offset off to the underlying output stream. |
4 | This method writes the specified byte (the low eight bits of the argument b) to the underlying output stream. |
5 | This method writes a boolean to the underlying output stream as a 1-byte value. |
6 | This method writes out a byte to the underlying output stream as a 1-byte value. |
7 | This method writes out the string to the underlying output stream as a sequence of bytes. |
8 | This method writes a char to the underlying output stream as a 2-byte value, high byte first. |
9 | This method writes a string to the underlying output stream as a sequence of characters. |
10 | This method converts the double argument to a long using the doubleToLongBits method in class Double, and then writes that long value to the underlying output stream as an 8-byte quantity, high byte first. |
11 | This method converts the float argument to an int using the floatToIntBits method in class Float, and then writes that int value to the underlying output stream as a 4-byte quantity, high byte first. |
12 | This method writes an int to the underlying output stream as four bytes, high byte first. |
13 | This method writes a long to the underlying output stream as eight bytes, high byte first. |
14 | This method writes a short to the underlying output stream as two bytes, high byte first. |
15 | This method writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner. |
Methods inherited
This class inherits methods from the following classes −
Java.io.FilterOutputStream
Java.io.Object
Java.io.DataOutput