Package com.hazelcast.nio

Examples of com.hazelcast.nio.BufferObjectDataOutput.toByteArray()


        final BufferObjectDataOutput out = sendOutput;
        synchronized (sendLock) {
            try {
                out.writeByte(Packet.VERSION);
                out.writeObject(joinMessage);
                datagramPacketSend.setData(out.toByteArray());
                multicastSocket.send(datagramPacketSend);
                out.clear();
            } catch (IOException e) {
                logger.warning("You probably have too long Hazelcast configuration!", e);
            }
View Full Code Here


    public byte[] write(Object object) throws IOException {
        final BufferObjectDataOutput out = service.pop();
        byte[] bytes;
        try {
            serializer.write(out, object);
            bytes = out.toByteArray();
        } finally {
            service.push(out);
        }
        return bytes;
    }
View Full Code Here

        try {
            out.writeInt(tasks.size());
            for (Operation task : tasks) {
                serializationService.writeObject(out, task);
            }
            data = out.toByteArray();
        } finally {
            closeResource(out);
        }
        return data;
    }
View Full Code Here

        transferClassDefinition(data, serializationService, serializationService2);

        // emulate socket write by writing data to stream
        BufferObjectDataOutput out = serializationService.createObjectDataOutput(1024);
        out.writeData(data);
        byte[] bytes = out.toByteArray();
        byte[] header = ((PortableDataOutput) out).getPortableHeader();

        // emulate socket read by reading data from stream
        BufferObjectDataInput in = serializationService2.createObjectDataInput(new DefaultData(0, bytes, 0, header));
        data = in.readData();
View Full Code Here

            serializer.write(out, object);
            byte[] header = null;
            if (out instanceof PortableDataOutput) {
                header = ((PortableDataOutput) out).getPortableHeader();
            }
            return new DefaultData(serializer.getTypeId(), out.toByteArray(), partitionHash, header);
        } finally {
            service.push(out);
        }
    }
View Full Code Here

            // WARNING: we can't pass original Data to the user
            int size = QuickMath.normalize(value.dataSize(), BUFFER_SIZE_FACTOR);
            BufferObjectDataOutput out = serializationService.createObjectDataOutput(size);
            try {
                out.writeData(value);
                actualValue = out.toByteArray();
            } catch (IOException e) {
                throw new HazelcastException(e);
            } finally {
                IOUtil.closeResource(out);
            }
View Full Code Here

            // since we need to do array copy for each item.
            BufferObjectDataOutput out = serializationService.createObjectDataOutput(OUTPUT_SIZE);
            try {
                for (Map.Entry<Long, Data> entry : map.entrySet()) {
                    out.writeData(entry.getValue());
                    objectMap.put(entry.getKey(), out.toByteArray());
                    out.clear();
                }
            } catch (IOException e) {
                throw new HazelcastException(e);
            } finally {
View Full Code Here

        private byte[] toClassDefinitionBinary(ClassDefinition cd) throws IOException {
            BufferObjectDataOutput out = serializationService.pop();
            try {
                writeClassDefinition(cd, out);
                byte[] binary = out.toByteArray();
                out.clear();
                compress(binary, out);
                return out.toByteArray();
            } finally {
                serializationService.push(out);
View Full Code Here

            try {
                writeClassDefinition(cd, out);
                byte[] binary = out.toByteArray();
                out.clear();
                compress(binary, out);
                return out.toByteArray();
            } finally {
                serializationService.push(out);
            }
        }
View Full Code Here

            BufferObjectDataOutput out = serializationService.pop();
            byte[] binary;
            try {
                decompress(compressedBinary, out);
                binary = out.toByteArray();
            } finally {
                serializationService.push(out);
            }

            ClassDefinitionImpl cd = readClassDefinition(serializationService.createObjectDataInput(binary));
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.