Examples of Blob


Examples of jfix.db4o.Blob

  public Blob toBlob(Node node) {
    if (node == null) {
      return null;
    }
    try {
      Blob blob = new Blob();
      Writer writer = Files.newWriter(blob.getFile());
      toXML(node, writer);
      writer.close();
      return blob;
    } catch (IOException e) {
      throw new RuntimeException(e);
View Full Code Here

Examples of leodagdag.play2morphia.Blob

            public void run() {
                File picture = new File("public/images/test/test.jpg");
                Post post = new Post();
                post.title = "fake post";
                String mimetype = MimeTypes.forFileName(picture.getName()).get();
                Blob blob = new Blob(picture, mimetype);
                post.picture = blob;
                post.insert();
                ObjectId id = post.id;

                post = Post.find().byId(id);
View Full Code Here

Examples of oracle.sql.BLOB

            stmt = connection.createStatement();
            rs = stmt.executeQuery(theQuery);
            if (rs.next()) {

                BLOB blob = (oracle.sql.BLOB) rs.getBlob(1);

                out = blob.getBinaryOutputStream();
                chunkSize = blob.getChunkSize();
                logger.debug9(".. current chunk size: " + chunkSize);
                byte[] buffer = new byte[chunkSize];

                int bytesRead = 0;
                while ((bytesRead = in.read(buffer)) != -1) {
View Full Code Here

Examples of oracle.sql.BLOB

            theQuery = normalizeStatement(query.toString(), replacement);
            logger.debug9(".. select the BLOB: " + theQuery);

            rs = stmt.executeQuery(theQuery);
            if (rs.next()) {
                BLOB blob = (oracle.sql.BLOB) rs.getBlob(1);
                out = blob.getBinaryOutputStream();
                chunkSize = blob.getChunkSize();
                logger.debug9(".. current chunk size: " + chunkSize);
                byte[] buffer = new byte[chunkSize];
                int bytesRead = 0;
                while ((bytesRead = in.read(buffer)) != -1) {
                    out.write(buffer, 0, bytesRead);
View Full Code Here

Examples of org.akubraproject.Blob

  @Test
  public void testIdMapperStore() throws UnsupportedOperationException,
      IOException {
    BlobStoreConnection connnection = blobStore.openConnection(null, null);
    Blob blob = null;
    try {
      blob = connnection.getBlob(new URI(
          "info:fedora/bhle:10706-a000test/OLEF"), null);
    } catch (UnsupportedIdException e) {
      e.printStackTrace();
    } catch (UnsupportedOperationException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (URISyntaxException e) {
      e.printStackTrace();
    }
    OutputStream out = null;
    try {
      out = blob.openOutputStream(-1, true);
    } catch (DuplicateBlobException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    try {
      out.write("SOMETHING ID!".getBytes());
      out.close();
    } catch (IOException e) {
      e.printStackTrace();
    }

    try {
      blob = connnection.getBlob(new URI(
          "info:fedora/bhle:10706-a000test/OLEF"), null);
      Assert.assertTrue(blob.exists());
      blob.delete();
      Assert.assertFalse(blob.exists());
      connnection.close();
    } catch (URISyntaxException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of org.apache.derby.client.am.Blob

                    // the follow types are possible due to promotion to BLOB
                    if (parameterType == Types.BLOB
                            || parameterType == Types.BINARY
                            || parameterType == Types.VARBINARY
                            || parameterType == Types.LONGVARBINARY) {
                        Blob o = (Blob) retrievePromotedParameterIfExists(index);
                        java.sql.Blob b = (o == null) ? (java.sql.Blob) inputRow[index] : o;
                        boolean isExternalBlob = !(b instanceof org.apache.derby.client.am.Blob);
                        if (isExternalBlob) {
                            try {
                                writeScalarStream(chainFlag,
View Full Code Here

Examples of org.apache.derby.client.am.Blob

                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absence of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.LONGVARBINARY:
                    ba = (byte[]) inputRow[i];
                    if (ba == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else if (ba.length <= 32767) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLONGVARBYTE;
                        lidAndLengths[i][1] = 32767;
                    } else {
                        // Promote to a BLOB. Only reach this path in the absensce of describe information.
                        Blob b = new Blob(ba, netAgent_, 0);

                        // inputRow[i] = b;
                        // Place the new Lob in the promototedParameter_ collection for
                        // NetStatementRequest use
                        promototedParameters_.put(new Integer(i), b);

                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] = buildPlaceholderLength(ba.length);
                    }
                    break;
                case java.sql.Types.BLOB:
                    java.sql.Blob b = (java.sql.Blob) inputRow[i];
                    if (b == null) {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        lidAndLengths[i][1] =
                                buildPlaceholderLength(parameterMetaData.sqlLength_[i]);
                    } else if (b instanceof Blob && ((Blob)b).isLocator()){
                        //we are sending locators.
                        //Here the LID local identifier in the FDODSC
                        //FD:OCA descriptor should be initialized as
                        //to contain a BLOB locator.
                        lidAndLengths[i][0] =
                                    DRDAConstants.DRDA_TYPE_NLOBLOC;
                        lidAndLengths[i][1] = 4;
                    } else {
                        lidAndLengths[i][0] = DRDAConstants.DRDA_TYPE_NLOBBYTES;
                        try {
                           
                            if( b instanceof Blob &&
                                ( (Blob) b).willBeLayerBStreamed() ){
                               
                                //Correspond to totalLength 0 as default length for unknown
                                lidAndLengths[i][1] = 0x8002;
                                   
                            }else {
                                lidAndLengths[i][1] = buildPlaceholderLength(b.length());
                               
                            }
                        } catch (java.sql.SQLException e) {
                            throw new SqlException(netAgent_.logWriter_,
                                new ClientMessageId(SQLState.NET_ERROR_GETTING_BLOB_LENGTH), e);
View Full Code Here

Examples of org.apache.derby.client.am.Blob

            netResultSet_.markLOBAsAccessed(column);
        }
        // Check for locator
        int locator = locator(column);
        if (locator > 0) { // Create locator-based LOB object
            return new Blob(agent, locator);
        }
       
        // The Blob value has been sent instead of locator
        int index = column - 1;
        int dataOffset;
        byte[] data;
        Blob blob = null;

        // locate the EXTDTA bytes, if any
        data = findExtdtaData(column);

        if (data != null) {
            // data found
            // set data offset based on the presence of a null indicator
            if (!nullable_[index]) {
                dataOffset = 0;
            } else {
                dataOffset = 1;
            }

            blob = new Blob(data, agent, dataOffset);
        } else {
            blob = new Blob(new byte[0], agent, 0);
        }

        return blob;
    }
View Full Code Here

Examples of org.apache.isis.applib.value.Blob

    protected Blob getBlobOrClobFrom(final List<FileUpload> fileUploads) {
        final FileUpload fileUpload = fileUploads.get(0);
        final String contentType = fileUpload.getContentType();
        final String clientFileName = fileUpload.getClientFileName();
        final byte[] bytes = fileUpload.getBytes();
        final Blob blob = new Blob(clientFileName, contentType, bytes);
        return blob;
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.api.Blob

        return r.id;
    }

    @Override
    public long getLength(String blobId) throws MicroKernelException {
        Blob blob = blobs.get(blobId);
        if (blob != null) {
            return blob.length();
        } else {
            throw new MicroKernelException("Blob not found: " + blobId);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.