org.metastatic.rsync.v2
Class MultiplexedOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--org.metastatic.rsync.v2.MultiplexedOutputStream
All Implemented Interfaces:
MultiplexedIO

public class MultiplexedOutputStream
extends OutputStream
implements MultiplexedIO

Multiplexed output for servers.


Field Summary
protected  Statistics stats
           
 
Fields inherited from interface org.metastatic.rsync.v2.MultiplexedIO
FERROR, FINFO, FLOG, FNONE, MPLEX_BASE
 
Constructor Summary
MultiplexedOutputStream(OutputStream out, boolean multiplex)
           
 
Method Summary
 void flush()
          Write any buffered bytes to the stream.
 Statistics getStats()
           
 void setMultiplex(boolean multiplex)
          Set multiplexing value.
 void setStats(Statistics stats)
           
 void write(byte[] buf)
          Writes a byte array to the stream.
 void write(byte[] buf, int off, int len)
          Writes a portion of a byte array to the stream.
 void write(int b)
          Write a single byte to the stream.
protected  void write(int logcode, byte[] buf)
           
protected  void write(int logcode, byte[] buf, int off, int len)
           
 void writeInt(int i)
          Write a four-byte integer to the stream in little-endian byte order.
 void writeLong(long l)
          Write a long integer to the stream, in little-endian order, writing four bytes if the value fits into four bytes, otherwise writing eight bytes.
 void writeMessage(int logcode, String message)
          Write a message to the multiplexed error stream.
 void writeString(String s)
           
 
Methods inherited from class java.io.OutputStream
close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stats

protected Statistics stats
Constructor Detail

MultiplexedOutputStream

public MultiplexedOutputStream(OutputStream out,
                               boolean multiplex)
Method Detail

setStats

public void setStats(Statistics stats)

getStats

public Statistics getStats()

setMultiplex

public void setMultiplex(boolean multiplex)
Set multiplexing value.

Parameters:
multiplex - The new multiplex value.

writeMessage

public void writeMessage(int logcode,
                         String message)
                  throws IOException
Write a message to the multiplexed error stream. If this object was not configured with to multiplex messages, then this method does nothing.

Parameters:
logcode - The log code.
message - The message.
Throws:
IOException - If an I/O error occurs.

flush

public void flush()
           throws IOException
Write any buffered bytes to the stream.

Overrides:
flush in class OutputStream
Throws:
IOException - If an I/O error occurs.

write

public void write(byte[] buf)
           throws IOException
Writes a byte array to the stream.

Overrides:
write in class OutputStream
Parameters:
buf - The bytes to write.
Throws:
IOException - If an I/O error occurs.

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws IOException
Writes a portion of a byte array to the stream.

Overrides:
write in class OutputStream
Parameters:
buf - The bytes to write.
off - The offset from whence to begin.
len - The number of bytes to write.
Throws:
IOException - If an I/O error occurs.

write

public void write(int b)
           throws IOException
Write a single byte to the stream.

Specified by:
write in class OutputStream
Throws:
IOException - If an I/O error occurs.

writeInt

public void writeInt(int i)
              throws IOException
Write a four-byte integer to the stream in little-endian byte order.

Parameters:
i - The integer to write.
Throws:
IOException - If an I/O error occurs.

writeLong

public void writeLong(long l)
               throws IOException
Write a long integer to the stream, in little-endian order, writing four bytes if the value fits into four bytes, otherwise writing eight bytes.

Parameters:
l - The long integer to write.
Throws:
IOException - If an I/O error occurs.

writeString

public void writeString(String s)
                 throws IOException
IOException

write

protected void write(int logcode,
                     byte[] buf)
              throws IOException
IOException

write

protected void write(int logcode,
                     byte[] buf,
                     int off,
                     int len)
              throws IOException
IOException