|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
squint.DataOutputChannel
public class DataOutputChannel
A DataOutputChannel is a stream designed to provide mechanisms to store or transmit data using distinct binary encoding schemes for various types of data (i.e. not just ASCII or UniCode). Objects of this class are used by the TCPConnection class for the "out" stream associated with a TCPConnection. It is also possible to create a DataOutputStream that provides a means to place data in a disk file. The interface to a DataOutputChannel is desiged to be very similar to the interface to a standard DataOutputStream, except that the methods of this class never throw checked exceptions. This makes it possible to use this class without inserting try/catch constructs around code that uses the class.
Constructor Summary | |
---|---|
DataOutputChannel(java.io.File f)
Create a DataOutputStream to store data within a file given a File object describing the desired file. |
|
DataOutputChannel(java.io.OutputStream dest)
Create a DataOutputStream given an OutputStream to use to actually perform data transfer. |
|
DataOutputChannel(java.lang.String fileName)
Create a DataOutputStream given a pathname within the local file system that identifies the desired file. |
Method Summary | |
---|---|
void |
close()
Close the stream. |
void |
flush()
Force any data pending transmission to be send through the network |
void |
write(byte[] buffer)
Sends all the bytes in array buffer through the channel. |
void |
write(byte[] data,
int offset,
int len)
Send part of a sequence of bytes of data through the channel starting at a particular offset within the sequence. |
void |
write(int data)
Sends the single byte of data found in the low order eight bits of the parameter value through the channel. |
void |
writeBoolean(boolean data)
Send a single boolean value (1 byte) through the channel. |
void |
writeByte(int data)
Sends the single byte of data found in the low order eight bits of the parameter value through the channel. |
void |
writeBytes(java.lang.String data)
Send all of the characters in a String through the connection as a sequence of bytes. |
void |
writeChar(int data)
Send a single character of data, which is comprised of two bytes, through the channel. |
void |
writeChars(java.lang.String data)
Send every character in the string s, through the channel, in order, two bytes per character. |
void |
writeDouble(double data)
Send a double value, which is comprised of eight bytes, through the channel. |
void |
writeFloat(float data)
Send a float value, which is comprised of four bytes, through the channel. |
void |
writeInt(int data)
Send an int value, which is comprised of four bytes, through the channel. |
void |
writeLong(long data)
Send a long value, which is comprised of eight bytes, through the channel. |
void |
writeShort(int data)
Send a single 2 byte integer value (short) through the channel. |
void |
writeUTF(java.lang.String data)
Send two bytes of length information through the channel, followed by the modified UTF-8 representation of every character in the parameter string. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataOutputChannel(java.io.File f)
f
- the file to be written.public DataOutputChannel(java.lang.String fileName)
fileName
- the full path name of the file to be written through the stream.public DataOutputChannel(java.io.OutputStream dest)
dest
- the underlying OutputStream through which the data will pass.Method Detail |
---|
public void flush()
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
public void close()
close
in interface java.io.Closeable
close
in class java.io.OutputStream
public void writeBytes(java.lang.String data)
writeBytes
in interface java.io.DataOutput
data
- the string of values to be sentpublic void writeChars(java.lang.String data)
writeChars
in interface java.io.DataOutput
data
- the value to be sentpublic void write(int data)
write
in interface java.io.DataOutput
write
in class java.io.OutputStream
data
- the value to be sentpublic void writeByte(int data)
writeByte
in interface java.io.DataOutput
data
- the value to be sentpublic void writeChar(int data)
writeChar
in interface java.io.DataOutput
data
- the value to be sentpublic void writeShort(int data)
writeShort
in interface java.io.DataOutput
data
- the value to be sentpublic void writeInt(int data)
writeInt
in interface java.io.DataOutput
data
- the value to be sentpublic void writeLong(long data)
writeLong
in interface java.io.DataOutput
data
- the value to be sentpublic void writeFloat(float data)
writeFloat
in interface java.io.DataOutput
data
- the value to be sentpublic void writeDouble(double data)
writeDouble
in interface java.io.DataOutput
data
- the value to be sentpublic void writeBoolean(boolean data)
writeBoolean
in interface java.io.DataOutput
data
- the value to be sentpublic void writeUTF(java.lang.String data)
writeUTF
in interface java.io.DataOutput
data
- the string to be sentpublic void write(byte[] buffer)
write
in interface java.io.DataOutput
write
in class java.io.OutputStream
buffer
- array of bytes to be sendpublic void write(byte[] data, int offset, int len)
write
in interface java.io.DataOutput
write
in class java.io.OutputStream
data
- the sequence of bytesoffset
- the starting position within the sequencelen
- the number of bytes to send
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |