com.schooner.MemCached
Class SockOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.schooner.MemCached.SockOutputStream
All Implemented Interfaces:
Closeable, Flushable

public final class SockOutputStream
extends OutputStream

SockOutputStream is a outputstream based on socket. There will be a big buffer in the socket, which is 1Mb in default, you can put all bytes into this buffer easily, when it is full, it will flush the bytes into the socket.
Don't make the buffer too much small, or else you will have problem in memcached set operation.

Since:
2.5.0
Author:
Xingen Wang
See Also:
OutputStream, SchoonerSockIO

Constructor Summary
SockOutputStream(SchoonerSockIO sock)
          Constructor with SockIO.
 
Method Summary
 int getCount()
          get byte count, how many wrote.
 SchoonerSockIO getSock()
          get channel of this stream.
 void resetCount()
          reset the count;
 void write(byte[] b)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SockOutputStream

public SockOutputStream(SchoonerSockIO sock)
Constructor with SockIO.

Parameters:
sock - specified socket for this outputstream.
Method Detail

getCount

public final int getCount()
get byte count, how many wrote.

Returns:

resetCount

public final void resetCount()
reset the count;


getSock

public final SchoonerSockIO getSock()
get channel of this stream.

Returns:
channel specified with this stream.

write

public final void write(int b)
                 throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

write

public final void write(byte[] b)
                 throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

write

public final void write(byte[] b,
                        int off,
                        int len)
                 throws IOException
Overrides:
write in class OutputStream
Throws:
IOException


Copyright © 2012 Schooner Information Technology. All Rights Reserved.