A interface DataOutput
é implementada pelas classes
DataOutputStream
e RandomAccessFile
. Métodos
especificados nesta interface permitem a conversão de tipos primitivos
Java para seqüências de bytes.
Em geral, se há algum impedimento para realizar a saída da seqüência
de bytes, a exceção IOException
é gerada.
A documentação da API Java especifica os seguintes métodos para essa interface:
Method Summary | |
void |
write(byte[] b)
Writes to the output stream all the bytes in array b . |
void |
write(byte[] b,
int off,
int len)
Writes len bytes from array
b , in order, to
the output stream. |
void |
write(int b)
Writes to the output stream the eight low-order bits of the argument b . |
void |
writeBoolean(boolean v)
Writes a boolean value to this output stream. |
void |
writeByte(int v)
Writes to the output stream the eight low- order bits of the argument v . |
void |
writeBytes(String s)
Writes a string to the output stream. |
void |
writeChar(int v)
Writes a char value, wich
is comprised of two bytes, to the
output stream. |
void |
writeChars(String s)
Writes every character in the string s ,
to the output stream, in order,
two bytes per character. |
void |
writeDouble(double v)
Writes a double value,
which is comprised of eight bytes, to the output stream. |
void |
writeFloat(float v)
Writes a float value,
which is comprised of four bytes, to the output stream. |
void |
writeInt(int v)
Writes an int value, which is
comprised of four bytes, to the output stream. |
void |
writeLong(long v)
Writes an long value, which is
comprised of four bytes, to the output stream. |
void |
writeShort(int v)
Writes two bytes to the output stream to represent the value of the argument. |
void |
writeUTF(String str)
Writes two bytes of length information to the output stream, followed by the Java modified UTF representation of every character in the string s . |
© Ivan Luiz Marques Ricarte
DCA/FEEC/UNICAMP