Package java.io

Examples of java.io.DataOutputStream.writeInt()


            HFile.DEFAULT_BYTES_PER_CHECKSUM);
        long totalSize = 0;
        for (int blockId = 0; blockId < 2; ++blockId) {
          DataOutputStream dos = hbw.startWriting(BlockType.DATA);
          for (int i = 0; i < 1234; ++i)
            dos.writeInt(i);
          hbw.writeHeaderAndData(os);
          totalSize += hbw.getOnDiskSizeWithHeader();
        }
        os.close();
View Full Code Here


      DataOutputStream dos = hbw.startWriting(bt);
      int size = rand.nextInt(500);
      for (int j = 0; j < size; ++j) {
        // This might compress well.
        dos.writeShort(i + 1);
        dos.writeInt(j + 1);
      }

      if (expectedOffsets != null)
        expectedOffsets.add(os.getPos());
View Full Code Here

            includesMemstoreTS);
        long totalSize = 0;
        for (int blockId = 0; blockId < 2; ++blockId) {
          DataOutputStream dos = hbw.startWriting(BlockType.DATA);
          for (int i = 0; i < 1234; ++i)
            dos.writeInt(i);
          hbw.writeHeaderAndData(os);
          totalSize += hbw.getOnDiskSizeWithHeader();
        }
        os.close();
View Full Code Here

                            superType);
                    out.writeLong(desc.getHashCode());
                }

                if (_write_object_method == null)
                    out.writeInt(1);
                else
                    out.writeInt(2);

                FieldDescriptor[] fds = new FieldDescriptor[_fields.length];
                for (int i = 0; i < _fields.length; i++) {
View Full Code Here

                }

                if (_write_object_method == null)
                    out.writeInt(1);
                else
                    out.writeInt(2);

                FieldDescriptor[] fds = new FieldDescriptor[_fields.length];
                for (int i = 0; i < _fields.length; i++) {
                    fds[i] = _fields[i];
                }
View Full Code Here

         */
        DataOutputStream out = null;
        try {
            out = new DataOutputStream(response.getOutputStream());
            // 0) an int, the version of this datastream format - REMOTE_DEPLOY_RESPONSE_VER
            out.writeInt(REMOTE_DEPLOY_RESPONSE_VER);
            // 1) a UTF string, the status (should be "OK")
            out.writeUTF(status);
            if (filesCreated == fileCount) {
                // 2) an int, the number of files received
                out.writeInt(fileCount);
View Full Code Here

            out.writeInt(REMOTE_DEPLOY_RESPONSE_VER);
            // 1) a UTF string, the status (should be "OK")
            out.writeUTF(status);
            if (filesCreated == fileCount) {
                // 2) an int, the number of files received
                out.writeInt(fileCount);
                // 3) for each file:
                for (int i = 0; i < names.length; i++) {
                    // 3.1) a UTF String, the path to the file as saved to the server's filesystem
                    out.writeUTF(names[i]);
                }
View Full Code Here

                // x) new data would be added here
                // only send newer data depending on the REQUEST_VER that came in
            } else {
                // error occurred, so don't send back any filenames, just a zero count
                // 2) an int, the number of files received
                out.writeInt(0);
            }
        } finally {
            if (out != null) {
                out.flush();
                out.close();
View Full Code Here

  }

  public void testRead() throws IOException, TTransportException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    dos.writeInt(50);
    dos.write(byteSequence(0, 49));

    TMemoryBuffer membuf = new TMemoryBuffer(0);
    membuf.write(baos.toByteArray());
View Full Code Here

  }

  public void testDirectRead() throws IOException, TTransportException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    dos.writeInt(50);
    dos.write(byteSequence(0, 49));

    TMemoryBuffer membuf = new TMemoryBuffer(0);
    membuf.write(baos.toByteArray());
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.