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

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

public class BlobStreamingParameter
extends java.lang.Object
implements ParameterHolder

Holds a blobstreaming parameter. protocol works like this when uploading a stream: 1. upload stream to http://:// 2. execute the insert using the blob reference returned


Constructor Summary
BlobStreamingParameter(java.io.InputStream is, java.lang.String host, java.lang.String port, java.lang.String schema)
          Create a new StreamParameter.
 
Method Summary
 long length()
          Returns the length of the parameter - this is the length of the blob reference Since we don't know the length of the reference before it has been uploaded, it is uploaded in this method.
 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

BlobStreamingParameter

public BlobStreamingParameter(java.io.InputStream is,
                              java.lang.String host,
                              java.lang.String port,
                              java.lang.String schema)
                       throws java.io.IOException
Create a new StreamParameter.

Parameters:
is - the input stream to create the parameter from
Throws:
java.io.IOException
Method Detail

writeTo

public final 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()
                  throws java.io.IOException
Returns the length of the parameter - this is the length of the blob reference Since we don't know the length of the reference before it has been uploaded, it is uploaded in this method.

Specified by:
length in interface ParameterHolder
Returns:
the length of the blob reference
Throws:
java.io.IOException


Copyright © 2012. All Rights Reserved.