[OutputStream] - Método flush()  XML
Índice dos Fóruns » Assuntos gerais (Off-topic)
Autor Mensagem
lina
Moderador
[Avatar]

Membro desde: 23/12/2006 21:05:04
Mensagens: 3083
Offline

Oi,

Estava eu lendo o javadoc do método flush() super empolgada... até que cheguei na ultima linha:

Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.
If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

The flush method of OutputStream does nothing.


Será que devo seguir a linha de Moises?!

Tchauzin!

Você é novo no GUJ? Vai criar um tópico e colar seu código-fonte? Leia aqui antes, por favor!
http://www.guj.com.br/posts/list/50115.java

Se o seu tópico foi respondido e você está satisfeito, segue:
- Pressione o botão <Edit> de seu primeiro post
- Acrescente no final do título a tag [RESOLVIDO]

@gujgirl

http://www.restartfans.hdfree.com.br

Meu blog:

http://www.runthecode.wordpress.com

Tchauzin!
[Email]
entanglement
GUJ Hacker

Membro desde: 26/09/2009 09:18:56
Mensagens: 5750
Offline

Leia-se "a implementação do método "flush" em OutputStream, que é uma classe abstrata, não faz nada "per se".
Entretanto, ele está lá para que OutputStream implemente a interface Flushable.
Uma classe concreta como "FileOutputStream" tem uma implementação para "flush" que, como você deve ter imaginado, deve chamar o método fflush (ou seu correspondente) para efetuar o flush dos bytes no disco.
Outra classe concreta como "ByteArrayOutputStream" tem uma implementação para "flush" que não faz nada.
Portanto, o comportamento "concreto" depende da classe concreta.
 
Índice dos Fóruns » Assuntos gerais (Off-topic)
Ir para:   
Powered by JForum 2.1.8 © JForum Team