Package com.google.common.io

Examples of com.google.common.io.CountingInputStream


    public TestingResponse(HttpStatus status, ListMultimap<String, String> headers, InputStream input)
    {
        this.status = checkNotNull(status, "status is null");
        this.headers = ImmutableListMultimap.copyOf(checkNotNull(headers, "headers is null"));
        this.countingInputStream = new CountingInputStream(checkNotNull(input, "input is null"));
    }
View Full Code Here


            if (countingInputStream == null) {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    InputStream content = entity.getContent();
                    if (content != null) {
                        countingInputStream = new CountingInputStream(content);
                    }
                }
            }

            if (countingInputStream == null) {
View Full Code Here

    public TestingResponse(HttpStatus status, ListMultimap<String, String> headers, InputStream input)
    {
        this.status = checkNotNull(status, "status is null");
        this.headers = ImmutableListMultimap.copyOf(checkNotNull(headers, "headers is null"));
        this.countingInputStream = new CountingInputStream(checkNotNull(input, "input is null"));
    }
View Full Code Here

        this.sorter = sorter;
    }

    public void sort(InputStream inputStream, OutputStream outputStream) {
        long begin = System.currentTimeMillis();
        CountingInputStream countingInputStream = new CountingInputStream(inputStream);
        doSort(countingInputStream, outputStream);
        LogUtils.infoTimeTaken(LOG, begin, countingInputStream.getCount(), "Sorted stream of %d bytes", countingInputStream.getCount());
    }
View Full Code Here

        for (int i = 0; i < columnHandles.size(); i++) {
            ExampleColumnHandle columnHandle = columnHandles.get(i);
            fieldToColumnIndex[i] = columnHandle.getOrdinalPosition();
        }

        try (CountingInputStream input = new CountingInputStream(inputStreamSupplier.getInput())) {
            lines = asByteSource(inputStreamSupplier).asCharSource(StandardCharsets.UTF_8).readLines().iterator();
            totalBytes = input.getCount();
        }
        catch (IOException e) {
            throw Throwables.propagate(e);
        }
    }
View Full Code Here

   
    public TestARCReader(InputStream is) {
        setIn(is);
    }
    public TestARCReader(WARCRecordInfo recinfo) throws IOException {
        setIn(new CountingInputStream(buildRecordContent(recinfo)));
        // ARCRecord tries to read off version-block if offset==0 and
        // alignedOnFirstRecord is true (it is by default). As we don't have
        // version-block at offset 0, we disable this behavior.
        setAlignedOnFirstRecord(false);
    }
View Full Code Here

    public TestWARCReader(InputStream is) {
        setIn(is);
    }
    public TestWARCReader(WARCRecordInfo recinfo) throws IOException {
        // not clearly stated, but ArchiveReader expects CountingInputStream.
        setIn(new CountingInputStream(TestWARCReader.buildRecordContent(recinfo)));
    }
View Full Code Here

TOP

Related Classes of com.google.common.io.CountingInputStream

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.