Class ImportBlob

java.lang.Object
org.apache.derby.impl.load.ImportBlob
All Implemented Interfaces:
Blob

class ImportBlob extends Object implements Blob
This class implements java.sql.BLOB interface . Objects created using the ImportBlob class are intended to be be used to create a blob object of the data stored in an import file or as an hex string. Only the routines that are needed read the blob data for the blob columns by the inserts done through the VTI have real implementations, Other routines are dummy ones to satisfy java.sql.Blob interface.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private byte[]
     
    private long
     
    private long
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ImportBlob(byte[] data)
    Create a import Blob object, whose value is the give hex data string.
    ImportBlob(ImportLobFile lobFile, long position, long length)
    Create a import Blob object, that reads length amount of data from an external file, starting at position .
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Raise error, not used by import
    Returns BLOB value designated by this Blob object as a input stream.
    getBinaryStream(long pos, long length)
    Raise error, not used by import
    byte[]
    getBytes(long pos, int length)
    This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.
    long
    Returns the number of bytes in this BLOB object.
    private SQLException
    Return an unimplemented feature error
    long
    position(byte[] pattern, long start)
    This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.
    long
    position(Blob pattern, long start)
    This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
    setBinaryStream(long pos)
    This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
    int
    setBytes(long pos, byte[] bytes)
    This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
    int
    setBytes(long pos, byte[] bytes, int offset, int len)
    This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
    void
    truncate(long len)
    This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • lobFile

      private ImportLobFile lobFile
    • blobPosition

      private long blobPosition
    • blobLength

      private long blobLength
    • blobData

      private byte[] blobData
  • Constructor Details

    • ImportBlob

      public ImportBlob(ImportLobFile lobFile, long position, long length)
      Create a import Blob object, that reads length amount of data from an external file, starting at position .
      Parameters:
      lobFile - lob file resource object, using which data is read.
      position - byte offset in the file, of this blob columb data.
      length - length of this blob object data.
    • ImportBlob

      public ImportBlob(byte[] data)
      Create a import Blob object, whose value is the give hex data string.
      Parameters:
      data - byte array that contains the blob data.
  • Method Details

    • length

      public long length() throws SQLException
      Returns the number of bytes in this BLOB object.
      Specified by:
      length in interface Blob
      Returns:
      length of the BLOB in bytes
      Throws:
      SQLException - on any error.
    • getBinaryStream

      public InputStream getBinaryStream() throws SQLException
      Returns BLOB value designated by this Blob object as a input stream.
      Specified by:
      getBinaryStream in interface Blob
      Returns:
      a stream containing the BLOB data
      Throws:
      SQLException - if any error occurs while setting up this blob data in the import file as stream.
    • getBytes

      public byte[] getBytes(long pos, int length) throws SQLException
      This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.
      Specified by:
      getBytes in interface Blob
      Throws:
      SQLException
      See Also:
    • position

      public long position(byte[] pattern, long start) throws SQLException
      This routine is not used by the VTI to read the data, so no implementatio is provided , an exception is thrown if used.
      Specified by:
      position in interface Blob
      Throws:
      SQLException
      See Also:
    • position

      public long position(Blob pattern, long start) throws SQLException
      This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
      Specified by:
      position in interface Blob
      Throws:
      SQLException
      See Also:
    • setBytes

      public int setBytes(long pos, byte[] bytes) throws SQLException
      This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
      Specified by:
      setBytes in interface Blob
      Throws:
      SQLException
      See Also:
    • setBytes

      public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException
      This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
      Specified by:
      setBytes in interface Blob
      Throws:
      SQLException
      See Also:
    • setBinaryStream

      public OutputStream setBinaryStream(long pos) throws SQLException
      This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
      Specified by:
      setBinaryStream in interface Blob
      Throws:
      SQLException
      See Also:
    • truncate

      public void truncate(long len) throws SQLException
      This routine is not used by the VTI to read the data, so no implementation is provided , an exception is thrown if used.
      Specified by:
      truncate in interface Blob
      Throws:
      SQLException
      See Also:
    • getBinaryStream

      public InputStream getBinaryStream(long pos, long length) throws SQLException
      Raise error, not used by import
      Specified by:
      getBinaryStream in interface Blob
      Throws:
      SQLException
    • free

      public void free() throws SQLException
      Raise error, not used by import
      Specified by:
      free in interface Blob
      Throws:
      SQLException
    • methodNotImplemented

      private SQLException methodNotImplemented()
      Return an unimplemented feature error