Examples of Compression


Examples of com.fasterxml.storemate.shared.compress.Compression

        JdkHttpClientPathBuilder path = _server.rootPath();
        path = _pathFinder.appendPath(path, PathType.STORE_ENTRY);
        path = _keyConverter.appendToPath(path, contentId);

        // Is compression known?
        Compression comp = content.getExistingCompression();
        if (comp != null) { // if so, must be indicated
            path = path.addCompression(comp, content.uncompressedLength());
        }
        if (params != null) {
            path = params.appendToPath(path, contentId);
View Full Code Here

Examples of com.fasterxml.storemate.shared.compress.Compression

            InputStream in = conn.getInputStream();
            // Then, anything to uncompress?
            String comps = conn.getHeaderField(ClusterMateConstants.HTTP_HEADER_COMPRESSION);
            if (comps != null && !comps.isEmpty()) {
                Compression comp = Compression.from(comps);
                if (comp != null) {
                    in = Compressors.uncompressingStream(in, comp);
                }
            }
            Handler<T> h = processor.createHandler();
View Full Code Here

Examples of com.fasterxml.storemate.shared.compress.Compression

        final long accessTime = _timeMaster.currentTimeMillis();
        final E entry = _entryConverter.entryFromStorable(rawEntry);

        updateLastAccessedForGet(request, response, entry, accessTime);
       
        Compression comp = entry.getCompression();
        boolean skipCompression;

        // Range to resolve, now that we know full length?
        if (range != null) {
            range = range.resolveWithTotalLength(entry.getActualUncompressedLength());
            final long length = range.calculateLength();
            // any bytes matching? If not, it's a failure
            if (length <= 0L) {
                return response.badRange(new GetErrorResponse<K>(key, "Invalid 'Range' HTTP Header (\""+range+"\")"));
            }
            // note: can not skip decompress if we have to give range...
            skipCompression = false;
        } else {
            skipCompression = (comp != Compression.NONE) && comp.isAcceptable(acceptableEnc);
        }
       
        StreamingResponseContentImpl output;
       
        if (entry.hasExternalData()) { // need to stream from File
            File f = entry.getRaw().getExternalFile(_fileManager);
            output = new StreamingResponseContentImpl(f, skipCompression ? null : comp, range);
        } else { // inline
            ByteContainer inlined = entry.getRaw().getInlinedData();
            if (!skipCompression) {
                try {
                    inlined = Compressors.uncompress(inlined, comp, (int) entry.getRaw().getOriginalLength());
                } catch (IOException e) {
                    return internalGetError(response, e, key, "Failed to decompress inline data");
                }
            }
            output = new StreamingResponseContentImpl(inlined, range);
        }
        // one more thing; add header for range if necessary; also, response code differs
        if (range == null) {
            response = response.ok(output);
        } else {
            response = response.partialContent(output, range.asResponseHeader());
        }
        // Issue #6: Need to provide Etag, if content hash available
        int contentHash = rawEntry.getContentHash();
        if (contentHash != HashConstants.NO_CHECKSUM) {
            StringBuilder sb = new StringBuilder();
            sb.append('"');
            sb.append(contentHash);
            sb.append('"');
            response = response.addHeader(ClusterMateConstants.HTTP_HEADER_ETAG, sb.toString());
        }
       
        // also need to let client know we left compression in there:
        if (skipCompression) {
            response = response.setBodyCompression(comp.asContentEncoding());
        }
        return response;
    }
View Full Code Here

Examples of com.fasterxml.storemate.shared.compress.Compression

        final long accessTime = _timeMaster.currentTimeMillis();
        final E entry = _entryConverter.entryFromStorable(rawEntry);
        updateLastAccessedForHead(request, response, entry, accessTime);
       
        // Other than this: let's only check out length of data there would be...
        final Compression comp = entry.getCompression();
        long size;
       
        // Would we return content as-is? (not compressed, or compressed using something
        // client accepts)
        String acceptableComp = request.getHeader(ClusterMateConstants.HTTP_HEADER_ACCEPT_COMPRESSION);
        if (comp == Compression.NONE || comp.isAcceptable(acceptableComp)) {
            size = entry.getStorageLength();
        } else {
            size = entry.getActualUncompressedLength();
        }
        return response.ok().setContentLength(size);
View Full Code Here

Examples of com.fasterxml.storemate.shared.compress.Compression

            OperationDiagnostics stats)
    {
        final long  creationTime = _timeMaster.currentTimeMillis();

        // first things first: ensure that request was correctly sent wrt routing
        Compression inputCompression = Compression.forContentEncoding(request.getHeader(
                ClusterMateConstants.HTTP_HEADER_COMPRESSION));
        // NOTE: in future, may want to allow client to specify "do not compress"; if so,
        // we would pass Compression.NONE explicitly: null means "try to use whatever"
        if (inputCompression == Compression.NONE) {
            inputCompression = null;
View Full Code Here

Examples of com.fasterxml.storemate.shared.compress.Compression

        }
        if (oldEntry.getCompressedHash() != newEntry.compressedContentHash) {
            return "checksumForCompressed differ; old had 0x"+Integer.toHexString(oldEntry.getCompressedHash())
                    +", new 0x"+Integer.toHexString(newEntry.compressedContentHash);
        }
        Compression oldC = oldEntry.getCompression();
        Compression newC = newEntry.compression;
        if (newC == null) {
            newC = Compression.NONE;
        }
        if (oldC != newC) {
            return "entity compression differs; old had "+oldC+" new "+newC;
View Full Code Here

Examples of edu.harvard.hul.ois.ots.schemas.MIX.Compression

                    switch (fitsElem) {
                    case byteOrder:
                        mm.bdoi.setByteOrder(dataValue);
                        break;
                    case compressionScheme:
                        Compression cmp = new Compression ();
                        mm.bdoi.setCompression (cmp);
                        cmp.setCompressionScheme (dataValue);
                        break;
                    case imageWidth:
                        mm.bic.setImageWidth(Integer.parseInt (dataValue));
                        break;
                    case imageHeight:
View Full Code Here

Examples of net.bpiwowar.mg4j.extensions.Compression

        final Gson gson = new GsonBuilder()
                .create();
        final DocumentsConfiguration conf = gson.fromJson(new InputStreamReader(stream), DocumentsConfiguration.class);


        final Compression compression = Compression.fromString(conf.compression);
        LOGGER.info(String.format("Format is %s, compression  is %s", conf.format, compression));

        // Get the files
        LOGGER.info("Reading the file list");
        System.out.format("Document path: %s%n", conf.path);
View Full Code Here

Examples of net.schmizz.sshj.transport.compression.Compression

        final MAC mac_S2C = Factory.Named.Util.create(transport.getConfig().getMACFactories(),
                                                      negotiatedAlgs.getServer2ClientMACAlgorithm());
        mac_S2C.init(integrityKey_S2C);

        final Compression compression_S2C =
                Factory.Named.Util.create(transport.getConfig().getCompressionFactories(),
                                          negotiatedAlgs.getServer2ClientCompressionAlgorithm());
        final Compression compression_C2S =
                Factory.Named.Util.create(transport.getConfig().getCompressionFactories(),
                                          negotiatedAlgs.getClient2ServerCompressionAlgorithm());

        transport.getEncoder().setAlgorithms(cipher_C2S, mac_C2S, compression_C2S);
        transport.getDecoder().setAlgorithms(cipher_S2C, mac_S2C, compression_S2C);
View Full Code Here

Examples of org.apache.sshd.common.Compression

        Digest hash = kex.getHash();
        Cipher s2ccipher;
        Cipher c2scipher;
        Mac s2cmac;
        Mac c2smac;
        Compression s2ccomp;
        Compression c2scomp;

        if (sessionId == null) {
            sessionId = new byte[H.length];
            System.arraycopy(H, 0, sessionId, 0, H.length);
        }
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.