com.amazon.carbonado.lob
Class BlobClob

java.lang.Object
  extended by com.amazon.carbonado.lob.AbstractClob
      extended by com.amazon.carbonado.lob.BlobClob
All Implemented Interfaces:
Clob, Lob

public class BlobClob
extends AbstractClob

A Clob implementation which is backed by a Blob. Data is stored in the Blob using UTF-16BE encoding.

Author:
Brian S O'Neill, Bob Loblaw

Constructor Summary
BlobClob(Blob blob)
           
 
Method Summary
 long getLength()
          Returns the length of this Clob, in characters.
 Object getLocator()
          Returns an object which identifies the Lob data, which may be null if not supported.
protected  Blob getWrappedBlob()
           
 Reader openReader()
          Returns a Reader for reading Clob data, positioned at the start.
 Reader openReader(long pos)
          Returns a Reader for reading Clob data.
 Reader openReader(long pos, int bufferSize)
          Returns a Reader for reading Clob data.
 Writer openWriter()
          Returns a Writer for writing Clob data, positioned at the start.
 Writer openWriter(long pos)
          Returns a Writer for writing Clob data.
 Writer openWriter(long pos, int bufferSize)
          Returns a Writer for writing Clob data.
 void setLength(long length)
          Set the length of this Clob, in characters.
 
Methods inherited from class com.amazon.carbonado.lob.AbstractClob
asString, equals, hashCode, setValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlobClob

public BlobClob(Blob blob)
Parameters:
blob - blob to wrap
Method Detail

openReader

public Reader openReader()
                  throws FetchException
Description copied from interface: Clob
Returns a Reader for reading Clob data, positioned at the start. The Clob implementation selects an appropriate buffer size for the reader.

Returns:
Reader for this Blob, which is not guaranteed to be thread-safe
Throws:
FetchException

openReader

public Reader openReader(long pos)
                  throws FetchException
Description copied from interface: Clob
Returns a Reader for reading Clob data. The Clob implementation selects an appropriate buffer size for the reader.

Parameters:
pos - desired zero-based position to read from
Returns:
Reader for this Blob, which is not guaranteed to be thread-safe
Throws:
FetchException

openReader

public Reader openReader(long pos,
                         int bufferSize)
                  throws FetchException
Description copied from interface: Clob
Returns a Reader for reading Clob data. A suggested buffer size must be provided, but it might be ignored by the Clob implementation.

Parameters:
pos - desired zero-based position to read from
bufferSize - suggest that the reader buffer be at least this large (in characters)
Returns:
Reader for this Blob, which is not guaranteed to be thread-safe
Throws:
FetchException

getLength

public long getLength()
               throws FetchException
Description copied from interface: Clob
Returns the length of this Clob, in characters.

Throws:
FetchException

openWriter

public Writer openWriter()
                  throws PersistException
Description copied from interface: Clob
Returns a Writer for writing Clob data, positioned at the start. The Clob implementation selects an appropriate buffer size for the writer.

Returns:
Writer for this Blob, which is not guaranteed to be thread-safe
Throws:
PersistException

openWriter

public Writer openWriter(long pos)
                  throws PersistException
Description copied from interface: Clob
Returns a Writer for writing Clob data. The Clob implementation selects an appropriate buffer size for the writer.

Parameters:
pos - desired zero-based position to write to
Returns:
Writer for this Blob, which is not guaranteed to be thread-safe
Throws:
PersistException

openWriter

public Writer openWriter(long pos,
                         int bufferSize)
                  throws PersistException
Description copied from interface: Clob
Returns a Writer for writing Clob data. A suggested buffer size must be provided, but it might be ignored by the Clob implementation.

Parameters:
pos - desired zero-based position to write to
bufferSize - suggest that the writer buffer be at least this large (in characters)
Returns:
Writer for this Blob, which is not guaranteed to be thread-safe
Throws:
PersistException

setLength

public void setLength(long length)
               throws PersistException
Description copied from interface: Clob
Set the length of this Clob, in characters. If the new length is shorter, the Clob is truncated. If the new length is longer, the Clob is padded with '\0' characters.

Parameters:
length - new length to set to
Throws:
PersistDeniedException - if Clob is read-only
PersistException

getLocator

public Object getLocator()
Description copied from interface: Lob
Returns an object which identifies the Lob data, which may be null if not supported.


getWrappedBlob

protected Blob getWrappedBlob()


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.