Package java.io

Examples of java.io.DataOutput.writeInt()


                        int read;
                        while ((read = fileInput.read(buffer)) > 0) {
                            output.writeInt(read);
                            output.write(buffer, 0, read);
                        }
                        output.writeInt(0);

                        output.writeLong(crc32.getValue());
                    }
                    try {
                        Thread.sleep(300);
View Full Code Here


      out.write(RPCFrame.SIGNATURE);
      out.write(RPCFrame.VERSION);

      // write header and payload sizes out to the stream
      out.writeInt(header.getLength());
      out.writeInt(payload.getLength());
      // and finally write out data
      out.write(header.getBuffer(), 0, header.getLength());
      out.write(payload.getBuffer(), 0, payload.getLength());
View Full Code Here

      out.write(RPCFrame.SIGNATURE);
      out.write(RPCFrame.VERSION);

      // write header and payload sizes out to the stream
      out.writeInt(header.getLength());
      out.writeInt(payload.getLength());
      // and finally write out data
      out.write(header.getBuffer(), 0, header.getLength());
      out.write(payload.getBuffer(), 0, payload.getLength());

      _stream.flush();
View Full Code Here

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        DataOutput dataOutput = new DataOutputStream(byteArrayOutputStream);
        byte[] tableBytes = table.getBytes();
        byte[] recordIdBytes = recordId.toBytes();
        try {
            dataOutput.writeInt(tableBytes.length);
            dataOutput.write(tableBytes);
            dataOutput.writeInt(recordIdBytes.length);
            dataOutput.write(recordIdBytes);
        } catch (IOException ioe) {
            throw new RuntimeException("Error serializing AbsoluteRecordId: " + toString(), ioe);
View Full Code Here

        byte[] tableBytes = table.getBytes();
        byte[] recordIdBytes = recordId.toBytes();
        try {
            dataOutput.writeInt(tableBytes.length);
            dataOutput.write(tableBytes);
            dataOutput.writeInt(recordIdBytes.length);
            dataOutput.write(recordIdBytes);
        } catch (IOException ioe) {
            throw new RuntimeException("Error serializing AbsoluteRecordId: " + toString(), ioe);
        }
        return byteArrayOutputStream.toByteArray();
View Full Code Here

                        BufferedInputStream fileInput = new BufferedInputStream(new FileInputStream(file));

                        byte[] buffer = new byte[8092];
                        int read;
                        while ((read = fileInput.read(buffer)) > 0) {
                            output.writeInt(read);
                            output.write(buffer, 0, read);
                        }
                        output.writeInt(0);

                        output.writeLong(crc32.getValue());
View Full Code Here

                        int read;
                        while ((read = fileInput.read(buffer)) > 0) {
                            output.writeInt(read);
                            output.write(buffer, 0, read);
                        }
                        output.writeInt(0);

                        output.writeLong(crc32.getValue());
                    }
                    try {
                        Thread.sleep(300);
View Full Code Here

    PositionCollector[] positions = new PositionCollector[1024];
    DataOutput stream = new DataOutputStream(out);
    for(int i=0; i < 1024; ++i) {
      positions[i] = new PositionCollector();
      out.getPosition(positions[i]);
      stream.writeInt(i);
    }
    out.flush();
    assertEquals("test", out.toString());
    assertEquals(1674, collect.buffer.size());
    ByteBuffer[] inBuf = new ByteBuffer[3];
View Full Code Here

    PositionCollector[] positions = new PositionCollector[1024];
    DataOutput stream = new DataOutputStream(out);
    for(int i=0; i < 1024; ++i) {
      positions[i] = new PositionCollector();
      out.getPosition(positions[i]);
      stream.writeInt(i);
    }
    out.flush();
    assertEquals("test", out.toString());
    assertEquals(4096, collect.buffer.size());
    ByteBuffer[] inBuf = new ByteBuffer[3];
View Full Code Here

            canon.writeLong(v);
        }
        {
            int v = rnd.nextInt();
            test.writeInt(v);
            canon.writeInt(v);
        }
        {
            short v = (short) rnd.nextInt();
            test.writeShort(v);
            canon.writeShort(v);
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.