Package com.ning.compress.lzf

Examples of com.ning.compress.lzf.LZFInputStream


            }

            assert remoteFile.estimatedKeys > 0;
            SSTableReader reader = null;
            logger.debug("Estimated keys {}", remoteFile.estimatedKeys);
            DataInputStream dis = new DataInputStream(new LZFInputStream(socket.getInputStream()));
            try
            {
                reader = streamIn(dis, localFile, remoteFile);
            }
            catch (IOException ex)
View Full Code Here


        desc = Descriptor.fromFilename(cfs.getTempSSTablePath(cfs.directories.getLocationForDisk(localDir)));

        SSTableWriter writer = new SSTableWriter(desc.filenameFor(Component.DATA), estimatedKeys);
        try
        {
            DataInputStream dis = new DataInputStream(new LZFInputStream(Channels.newInputStream(channel)));
            BytesReadTracker in = new BytesReadTracker(dis);

            while (in.getBytesRead() < totalSize)
            {
                writeRow(writer, in, cfs);
View Full Code Here

        if (comp != null) {
            switch (comp) {
            case NONE:
                break;
            case LZF:
                return new LZFInputStream(in);
            case GZIP:
                return new OptimizedGZIPInputStream(in);
            default: // sanity check
                throw new IllegalArgumentException("Unrecognized compression type: "+comp);
            }
View Full Code Here

        byte[] data = entry.getData();
        InputStream in = new ByteArrayInputStream(data, entry.getOffset(), entry.getSize());

        try {
            if (compress) {
                in = new LZFInputStream(in);
            }
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
        T info;
View Full Code Here

                    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

TOP

Related Classes of com.ning.compress.lzf.LZFInputStream

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.