Package java.sql

Examples of java.sql.Blob


    }
    else if (o instanceof Blob)
    {
      try
      {
        final Blob b = (Blob) o;
        final byte[] data = IOUtils.getInstance().readBlob(b);
        final ResourceManager resManager = runtime.getProcessingContext().getResourceManager();
        final Resource resource = resManager.createDirectly(data, Image.class);
        return new DefaultImageReference(resource);
      }
View Full Code Here


            return Any.NULL;
          }
        }

      case Types.BLOB:
        Blob blob = set.getBlob(field);
        if (blob != null) {
          return new AnyString(new String(blob.getBytes(0, (int)blob.length())));
        } else {
          return Any.NULL;
        }

      case Types.CLOB:
View Full Code Here

            return Any.NULL;
          }
        }

      case Types.BLOB:
        Blob blob = stmt.getBlob(field);
        if (blob != null) {
          return new AnyString(new String(blob.getBytes(0, (int)blob.length())));
        } else {
          return Any.NULL;
        }

      case Types.CLOB:
View Full Code Here

      {
        key = (ResourceKey) value;
      }
      else if (value instanceof Blob)
      {
        final Blob b = (Blob) value;
        final byte[] data = IOUtils.getInstance().readBlob(b);
        key = resManager.createKey(data);
      }
      else if (value instanceof String)
      {
View Full Code Here

    {
      return new ByteArrayInputStream((byte[]) o);
    }
    if (o instanceof Blob)
    {
      final Blob b = (Blob) o;
      try
      {
        return b.getBinaryStream();
      }
      catch (SQLException e)
      {
        throw new IOException("Failed to convert from BLOB");
      }
View Full Code Here

      {
        key = (ResourceKey) value;
      }
      else if (value instanceof Blob)
      {
        final Blob b = (Blob) value;
        final byte[] data = IOUtils.getInstance().readBlob(b);
        key = resManager.createKey(data);
      }
      else if (value instanceof String)
      {
View Full Code Here

            throw new Exception("An exception occured when processing '" + name + "'", ex);
         }
      }
      if (val instanceof Blob) { // only for relatively small clobs (< 10MB)
         try {
            Blob blob = (Blob)val;
            InputStream in = blob.getBinaryStream();
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            // StringBuffer strBuf = new StringBuffer();
            byte[] buf = new byte[100000];
            int read = 0;
            int count=0;
View Full Code Here

      DebugFile.incIdent();
    }

    JDCConnection oConn = null;
    PreparedStatement oStmt = null;
    Blob oContentTxt;
    ByteArrayOutputStream byOutPart;
    int iPrevPart = 0, iThisPart = 0, iNextPart = 0, iPartStart = 0;

    try {
      MimeMultipart oParts = (MimeMultipart) oMsg.getContent();
View Full Code Here

    return "DataBaseAvatarBase";
  }

  protected byte[] getBytes(String name) {
    SqlRowSet rowSet = jdbcTemplate.queryForRowSet(sql, name);
    Blob obj = null;
    if (rowSet.next()) {
      obj = (Blob) rowSet.getObject(1);
      try {
        return obj.getBytes(1L, (int) obj.length());
      } catch (SQLException e) {
        e.printStackTrace();
        return null;
      }
    } else {
View Full Code Here

    // We always get the BLOB, even when we are not reading the contents.
    // Since the BLOB is just a pointer to the BLOB data rather than the
    // data itself, this operation should not take much time (as opposed
    // to getting all of the data in the blob).
    Blob blob = rs.getBlob(index);

    if (rs.wasNull())
      return null;

    // BLOB exists, so try to read the data from it
    // based on the user's directions
    if (_readBlobs)
    {
      // User said to read at least some of the data from the blob
      byte[] blobData = null;
      if (blob != null)
      {
        int len = (int)blob.length();
        if (len > 0)
        {
          int charsToRead = len;
          if (! _readCompleteBlobs)
          {
            charsToRead = _readBlobsSize;
          }
          if (charsToRead > len)
          {
            charsToRead = len;
          }
          blobData = blob.getBytes(1, charsToRead);
        }
      }

      // determine whether we read all there was in the blob or not
      boolean wholeBlobRead = false;
View Full Code Here

TOP

Related Classes of java.sql.Blob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.