Class ConcreteBlob

java.lang.Object
xal.tools.database.ConcreteBlob
All Implemented Interfaces:
Blob

public class ConcreteBlob extends Object implements Blob
Concrete implementation of an SQL Blob.
  • Field Summary

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

    Constructors
    Constructor
    Description
    Constructor
    ConcreteBlob(int capacity)
    Primary Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    Get an input stream that can read the BLOB data.
    getBinaryStream(long position, long length)
     
    byte[]
    getBytes(long position, int length)
    Get the specified part of the blob data as an array of bytes.
    long
    Get the number of bytes in this BLOB.
    long
    position(byte[] pattern, long start)
    Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start.
    long
    position(Blob pattern, long start)
    Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start.
    setBinaryStream(long position)
    Get an output stream for writing to this BLOB.
    int
    setBytes(long position, byte[] bytes)
    Set the specified bytes.
    int
    setBytes(long position, byte[] bytes, int offset, int length)
    Set the specified bytes.
    void
    truncate(long length)
    Truncate this BLOB to be the specified length.

    Methods inherited from class java.lang.Object

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

    • data

      protected byte[] data
  • Constructor Details

    • ConcreteBlob

      public ConcreteBlob(int capacity)
      Primary Constructor
      Parameters:
      capacity - The number of bytes allocated for data storage.
    • ConcreteBlob

      public ConcreteBlob()
      Constructor
  • Method Details

    • getBinaryStream

      public InputStream getBinaryStream() throws SQLException
      Get an input stream that can read the BLOB data.
      Specified by:
      getBinaryStream in interface Blob
      Throws:
      SQLException
    • getBinaryStream

      public InputStream getBinaryStream(long position, long length)
      Specified by:
      getBinaryStream in interface Blob
    • free

      public void free()
      Specified by:
      free in interface Blob
    • getBytes

      public byte[] getBytes(long position, int length)
      Get the specified part of the blob data as an array of bytes.
      Specified by:
      getBytes in interface Blob
      Parameters:
      position -
    • length

      public long length()
      Get the number of bytes in this BLOB.
      Specified by:
      length in interface Blob
    • position

      public long position(Blob pattern, long start) throws SQLException
      Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start.
      Specified by:
      position in interface Blob
      Throws:
      SQLException
    • position

      public long position(byte[] pattern, long start)
      Get the position of the first occurrence of pattern in this BLOB starting at the position specified by start.
      Specified by:
      position in interface Blob
    • setBinaryStream

      public OutputStream setBinaryStream(long position)
      Get an output stream for writing to this BLOB. This implementation simply throws an unsupported operation exception.
      Specified by:
      setBinaryStream in interface Blob
    • setBytes

      public int setBytes(long position, byte[] bytes, int offset, int length)
      Set the specified bytes.
      Specified by:
      setBytes in interface Blob
    • setBytes

      public int setBytes(long position, byte[] bytes)
      Set the specified bytes.
      Specified by:
      setBytes in interface Blob
    • truncate

      public void truncate(long length)
      Truncate this BLOB to be the specified length.
      Specified by:
      truncate in interface Blob