Examples of LZFInputStream


Examples of com.ning.compress.lzf.LZFInputStream

                    id = iterator.next();
                    raw = objects.get(id);
                    if (raw != null) {
                        try {
                            found = serializationFactory.createObjectReader().read(id,
                                    new LZFInputStream(new ByteArrayInputStream(raw)));
                        } catch (IOException e) {
                            throw Throwables.propagate(e);
                        }
                        listener.found(found.getId(), raw.length);
                    } else {
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

        InputStream in = getRawInternal(id, failIfNotFound);
        if (null == in) {
            return null;
        }
        try {
            return new LZFInputStream(in);
        } catch (IOException e) {
            throw Throwables.propagate(e);
        }
    }
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

                    // lookup data for the next key
                    OperationStatus status;
                    status = cursor.getSearchKey(key, data, LockMode.READ_UNCOMMITTED);
                    if (SUCCESS.equals(status)) {
                        InputStream rawData;
                        rawData = new LZFInputStream(new ByteArrayInputStream(data.getData()));
                        found = reader.read(id, rawData);
                        listener.found(found.getId(), data.getSize());
                    } else {
                        listener.notFound(id);
                    }
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

    private RevObject fromBytes(ObjectId id, byte[] buffer) {
        ByteArrayInputStream byteStream = new ByteArrayInputStream(buffer);
        RevObject result;
        try {
            result = serializers.createObjectReader().read(id, new LZFInputStream(byteStream));
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
        return result;
    }
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

                    combined = in;
                }

                final long start = (_diagnostics == null) ? 0L : _timeMaster.nanosForDiagnostics();
                CountingInputStream counter = new CountingInputStream(combined);
                LZFInputStream lzfIn = new LZFInputStream(counter);
                try {
                     lzfIn.readAndWrite(out);
                } finally {
                    _close(lzfIn);
                    if (_diagnostics != null) {
                        final long totalSpent = _timeMaster.nanosForDiagnostics() - start;
                        // Not good, but need to try avoiding double-booking so assume 1/4 for response write
                        long respTime = (totalSpent >> 2);
                        _diagnostics.addResponseWriteTime(respTime);
                        _diagnostics.addFileReadAccess(start, start, start + totalSpent - respTime,
                                counter.readCount());
                    }
                }
                return null;
            }
        });

        // Fast case is out of file-access lock so must be handled here
        if (fullBuffer != null) {
            final long start = (_diagnostics == null) ? 0L : _timeMaster.nanosForDiagnostics();
            LZFInputStream lzfIn = new LZFInputStream(new BufferBackedInputStream(fullBuffer));
            try {
                lzfIn.readAndWrite(out);
            } finally {
                _close(lzfIn);
                 if (_diagnostics != null) {
                     _diagnostics.addResponseWriteTime(start, _timeMaster);
                 }
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

    public Object read(MessageBodyReaderContext context) throws IOException, WebApplicationException {

        Object encoding = context.getHeaders().getFirst(HttpHeaders.CONTENT_ENCODING);
        if (encoding != null && encoding.toString().equalsIgnoreCase("lzf")) {
            InputStream old = context.getInputStream();
            LZFInputStream is = new LZFInputStream(old);
            context.setInputStream(is);
            try {
                return context.proceed();
            } finally{
                context.setInputStream(old);
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

                    combined = in;
                }

                final long start = (_diagnostics == null) ? 0L : _timeMaster.nanosForDiagnostics();
                CountingInputStream counter = new CountingInputStream(combined);
                LZFInputStream lzfIn = new LZFInputStream(counter);
                try {
                     lzfIn.readAndWrite(out);
                } finally {
                    _close(lzfIn);
                    if (_diagnostics != null) {
                        final long totalSpent = _timeMaster.nanosForDiagnostics() - start;
                        // Not good, but need to try avoiding double-booking so assume 1/4 for response write
                        long respTime = (totalSpent >> 2);
                        _diagnostics.addResponseWriteTime(respTime);
                        _diagnostics.addFileReadAccess(start, start, start + totalSpent - respTime,
                                counter.readCount());
                    }
                }
                return null;
            }
        });

        // Fast case is out of file-access lock so must be handled here
        if (fullBuffer != null) {
            final long start = (_diagnostics == null) ? 0L : _timeMaster.nanosForDiagnostics();
            LZFInputStream lzfIn = new LZFInputStream(new BufferBackedInputStream(fullBuffer));
            try {
                lzfIn.readAndWrite(out);
            } finally {
                _close(lzfIn);
                 if (_diagnostics != null) {
                     _diagnostics.addResponseWriteTime(start, _timeMaster);
                 }
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

        Pair<String, String> kscf = Schema.instance.getCF(cfId);
        ColumnFamilyStore cfs = Keyspace.open(kscf.left).getColumnFamilyStore(kscf.right);

        SSTableWriter writer = createWriter(cfs, totalSize);
        DataInputStream dis = new DataInputStream(new LZFInputStream(Channels.newInputStream(channel)));
        BytesReadTracker in = new BytesReadTracker(dis);
        try
        {
            while (in.getBytesRead() < totalSize)
            {
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

            return;
        }
        InputStream in = new FileInputStream(_file);
        // First: LZF has special optimization to use, if we are to copy the whole thing:
        if ((_compression == Compression.LZF) && (_dataLength == -1)) {
              LZFInputStream lzfIn = new LZFInputStream(in);
              try {
                  lzfIn.readAndWrite(out);
              } finally {
                  _close(lzfIn);
              }
              return;
        }
View Full Code Here

Examples of com.ning.compress.lzf.LZFInputStream

            return;
        }
        InputStream in = new FileInputStream(_file);
        // First: LZF has special optimization to use, if we are to copy the whole thing:
        if ((_compression == Compression.LZF) && (_dataLength == -1)) {
              LZFInputStream lzfIn = new LZFInputStream(in);
              try {
                  lzfIn.readAndWrite(out);
              } finally {
                  try {
                      lzfIn.close();
                  } catch (IOException e) { }
              }
              return;
        }
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.