Package org.gradle.messaging.serialize.kryo

Examples of org.gradle.messaging.serialize.kryo.KryoBackedEncoder


    }

    public void put(K key, V value) {
        try {
            MessageDigestStream digestStream = new MessageDigestStream();
            KryoBackedEncoder encoder = new KryoBackedEncoder(digestStream);
            keySerializer.write(encoder, key);
            encoder.flush();
            long hashCode = digestStream.getChecksum();
            Lookup lookup = header.getRoot().find(hashCode);
            boolean needNewBlock = true;
            if (lookup.entry != null) {
                DataBlock block = store.read(lookup.entry.dataBlock, DataBlock.class);
View Full Code Here


            return store.read(lookup.entry.dataBlock, DataBlock.class);
        }

        public Lookup find(K key) throws Exception {
            MessageDigestStream digestStream = new MessageDigestStream();
            KryoBackedEncoder encoder = new KryoBackedEncoder(digestStream);
            keySerializer.write(encoder, key);
            encoder.flush();
            long checksum = digestStream.getChecksum();
            return find(checksum);
        }
View Full Code Here

            size = serialisedValue.length;
        }

        public void setValue(V value) throws Exception {
            ByteArrayOutputStream outStr = new ByteArrayOutputStream();
            KryoBackedEncoder encoder = new KryoBackedEncoder(outStr);
            serializer.write(encoder, value);
            encoder.flush();
            this.serialisedValue = outStr.toByteArray();
        }
View Full Code Here

    public void write(Collection<TestClassResult> results) {
        try {
            OutputStream outputStream = new FileOutputStream(resultsFile);
            try {
                if (!results.isEmpty()) { // only write if we have results, otherwise truncate
                    FlushableEncoder encoder = new KryoBackedEncoder(outputStream);
                    encoder.writeSmallInt(RESULT_VERSION);
                    write(results, encoder);
                    encoder.flush();
                }
            } finally {
                outputStream.close();
            }
        } catch (IOException e) {
View Full Code Here

        Decoder decoder = new KryoBackedDecoder(inputStream);
        return new MessageReader(decoder, payloadSerializer.newReader(decoder));
    }

    public ObjectWriter<InterHubMessage> newWriter(OutputStream outputStream) {
        FlushableEncoder encoder = new KryoBackedEncoder(outputStream);
        return new MessageWriter(encoder, payloadSerializer.newWriter(encoder));
    }
View Full Code Here

    }

    public void write(WriteAction write) {
        if (encoder == null) {
            try {
                encoder = new KryoBackedEncoder(new FileOutputStream(file));
            } catch (FileNotFoundException e) {
                throw throwAsUncheckedException(e);
            }
        }
        if (offset == -1) {
View Full Code Here

        private final Map<Long, Map<Long, TestCaseRegion>> index = new LinkedHashMap<Long, Map<Long, TestCaseRegion>>();

        public Writer() {
            try {
                output = new KryoBackedEncoder(new FileOutputStream(getOutputsFile()));
            } catch (FileNotFoundException e) {
                throw new UncheckedIOException(e);
            }
        }
View Full Code Here

TOP

Related Classes of org.gradle.messaging.serialize.kryo.KryoBackedEncoder

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.