Class DelayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- de.kappich.pat.testumg.util.connections.DelayOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
- Direct Known Subclasses:
WiretapOutputStream
public class DelayOutputStream extends java.io.OutputStreamOutputStream, der die Daten an einen weiterenOutputStreamweitergibt und dabei die Übertragungsrate begrenzt.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDISABLE_DELAYMit diesem Flag kann das Ausbremsen temporär deaktiviert werden (z.
-
Constructor Summary
Constructors Constructor Description DelayOutputStream(java.io.OutputStream outputStream, long transmissionDelayNanos, double maxFlowRate)Erstellt eine neue Instanz
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidenqueue(byte[] bytes)voidwrite(byte[] b)voidwrite(byte[] b, int off, int len)voidwrite(int b)
-
-
-
Constructor Detail
-
DelayOutputStream
public DelayOutputStream(java.io.OutputStream outputStream, long transmissionDelayNanos, double maxFlowRate)Erstellt eine neue Instanz- Parameters:
outputStream- GekapselterOutputStreamtransmissionDelayNanos- Feste minimale Verzögerung zwischen Senden und Empfang in Nanosekunden (Ping)maxFlowRate- Maximaler Durchsatz in Bytes/Sekunde
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
enqueue
protected void enqueue(byte[] bytes) throws java.io.IOException- Throws:
java.io.IOException
-
-