Package org.gradle.messaging.serialize

Examples of org.gradle.messaging.serialize.OutputStreamBackedEncoder


        });
    }

    private void serialize(T newValue) {
        try {
            OutputStreamBackedEncoder encoder = new OutputStreamBackedEncoder(new BufferedOutputStream(new FileOutputStream(cacheFile)));
            try {
                serializer.write(encoder, newValue);
            } finally {
                encoder.close();
            }
        } catch (Exception e) {
            throw new GradleException(String.format("Could not write cache value to '%s'.", cacheFile), e);
        }
    }
View Full Code Here


        target.print(daemonGreeting());

        // Encode as ascii
        try {
            OutputStream outputStream = new EncodedStream.EncodedOutput(target);
            FlushableEncoder encoder = new OutputStreamBackedEncoder(outputStream);
            encoder.writeNullableString(pid == null ? null : pid.toString());
            encoder.writeString(uid);
            MultiChoiceAddress multiChoiceAddress = (MultiChoiceAddress) address;
            UUID canonicalAddress = (UUID) multiChoiceAddress.getCanonicalAddress();
            encoder.writeLong(canonicalAddress.getMostSignificantBits());
            encoder.writeLong(canonicalAddress.getLeastSignificantBits());
            encoder.writeInt(multiChoiceAddress.getPort());
            encoder.writeSmallInt(multiChoiceAddress.getCandidates().size());
            for (InetAddress inetAddress : multiChoiceAddress.getCandidates()) {
                encoder.writeBinary(inetAddress.getAddress());
            }
            encoder.writeString(daemonLog.getPath());
            encoder.flush();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }

        target.println();
View Full Code Here

        }
    }

    public void put(K key, V value) {
        ByteArrayOutputStream outstr = new ByteArrayOutputStream();
        OutputStreamBackedEncoder encoder = new OutputStreamBackedEncoder(outstr);
        try {
            valueSerializer.write(encoder, value);
            encoder.flush();
        } catch (Exception e) {
            throw UncheckedException.throwAsUncheckedException(e);
        }

        entries.put(key, outstr.toByteArray());
View Full Code Here

TOP

Related Classes of org.gradle.messaging.serialize.OutputStreamBackedEncoder

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.