net.ranides.assira.io
Class OutputStreamThread

java.lang.Object
  extended by java.io.OutputStream
      extended by net.ranides.assira.io.OutputStreamThread
All Implemented Interfaces:
Closeable, Flushable

public final class OutputStreamThread
extends OutputStream

Strumień delegujący wszystkie bezpośrednie operacje I/O do osobnego wątku.

Author:
ranides

Constructor Summary
OutputStreamThread(OutputStream stream)
          Tworzy nowy strumień, który wszystkie operacje wykonuje asynchronicznie, w osobnym wątku, na rzecz podanego argumentu stream.
 
Method Summary
 void close()
           
 void flush()
           
 void onError(EventListener<IOEvent.Failure> handler)
           Rejestruje następnego obserwatora, który jest powiadamiany o wyjątkach IOException, które wystąpiły w czasie operacji I/O.
 void write(byte[] data)
           
 void write(byte[] data, int offset, int length)
           
 void write(int data)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputStreamThread

public OutputStreamThread(OutputStream stream)
Tworzy nowy strumień, który wszystkie operacje wykonuje asynchronicznie, w osobnym wątku, na rzecz podanego argumentu stream.

Parameters:
stream - strumień realizujący bezpośrednio operacje I/O
Method Detail

write

public void write(int data)
Specified by:
write in class OutputStream

write

public void write(byte[] data)
Overrides:
write in class OutputStream

write

public void write(byte[] data,
                  int offset,
                  int length)
Overrides:
write in class OutputStream

close

public void close()
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream

flush

public void flush()
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream

onError

public void onError(EventListener<IOEvent.Failure> handler)

Rejestruje następnego obserwatora, który jest powiadamiany o wyjątkach IOException, które wystąpiły w czasie operacji I/O. Ponieważ żadna z metod klasy nie rzuca wyjątków bezpośrednio, wszystkie informacje o błędach należy rejestrować za pomocą przekazanego obserwatora.

Można zarejestrować dowolną ilość obserwatorów, kolejne wywołania metody nie usuwają poprzednich obserwatorów.

Parameters:
handler -


Copyright © 2013. All Rights Reserved.