org.drizzle.jdbc.internal.common.query.parameters
Class StreamParameter

java.lang.Object
  extended by org.drizzle.jdbc.internal.common.query.parameters.StreamParameter
All Implemented Interfaces:
ParameterHolder

public class StreamParameter
extends java.lang.Object
implements ParameterHolder

Holds a stream parameter. User: marcuse Date: Feb 19, 2009 Time: 8:53:14 PM


Constructor Summary
StreamParameter(java.io.InputStream is, long readLength)
          Create a new StreamParameter.
 
Method Summary
 long length()
          Returns the length of the parameter - this is the total amount of bytes that will be sent.
 int writeTo(java.io.OutputStream os, int offset, int maxWriteSize)
          Writes the parameter to an outputstream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamParameter

public StreamParameter(java.io.InputStream is,
                       long readLength)
                throws java.io.IOException
Create a new StreamParameter.

Parameters:
is - the input stream to create the parameter from
readLength - the length to read
Throws:
java.io.IOException - if we cannot read the stream
Method Detail

writeTo

public int writeTo(java.io.OutputStream os,
                   int offset,
                   int maxWriteSize)
            throws java.io.IOException
Writes the parameter to an outputstream.

Specified by:
writeTo in interface ParameterHolder
Parameters:
os - the outputstream to write to
offset - where to start writing
maxWriteSize - max number of bytes to write
Returns:
the number of bytes written (either maxWriteSize or the length of the parameter)
Throws:
java.io.IOException - if we cannot write to the stream

length

public final long length()
Returns the length of the parameter - this is the total amount of bytes that will be sent.

Specified by:
length in interface ParameterHolder
Returns:
the length of the parameter


Copyright © 2012. All Rights Reserved.