Package java.io

Examples of java.io.DataOutputStream.writeInt()


                    return false;
                }
                // System.out.println(" x=" + (char)x+" " +x);
                dataOut.write(x);
                int len = dataIn.readInt();
                dataOut.writeInt(len);
                len -= 4;
                byte[] data = new byte[len];
                dataIn.readFully(data, 0, len);
                dataOut.write(data);
                dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
View Full Code Here


                return false;
            }
            // System.out.println(" x=" + (char)x+" " +x);
            dataOut.write(x);
            int len = dataIn.readInt();
            dataOut.writeInt(len);
            len -= 4;
            byte[] data = new byte[len];
            dataIn.readFully(data, 0, len);
            dataOut.write(data);
            dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
View Full Code Here

 
  @Test public void testLargeIntConversion() throws Exception {
    int testValue = 204503404;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(baos);
    dos.writeInt(testValue);
    dos.close();
    assertEquals(testValue, ObjectDecoderInputStream.getIntFromBytes(baos.toByteArray()));
  }
 
 
View Full Code Here

                int i = 0;
                long end = System.currentTimeMillis();
                while (end == System.currentTimeMillis()) {
                    i++;
                }
                out.writeInt(i);
            }

            out.close();
            return bout.toByteArray();
        } catch (IOException e) {
View Full Code Here

                // nanoTime not found, this is ok (only exists for JDK 1.5 and higher)
                out.writeUTF(e.toString());
            }

            // memory
            out.writeInt(new Object().hashCode());
            Runtime runtime = Runtime.getRuntime();
            out.writeLong(runtime.freeMemory());
            out.writeLong(runtime.maxMemory());
            out.writeLong(runtime.totalMemory());
View Full Code Here

 
          DataOutputStream dos = new DataOutputStream( socket.getOutputStream());
         
          byte[]  beacon_out = _tivo_manager.encodeBeacon( false, 0 );
         
          dos.writeInt( beacon_out.length );   
       
          dos.write( beacon_out );       
           
          DataInputStream dis = new DataInputStream( socket.getInputStream());
         
View Full Code Here

    }

    DataOutputStream output = null;
    try {
      output = new DataOutputStream(new FileOutputStream(file));
      output.writeInt(character.id);
      output.writeUTF(character.otherStuff);
      output.writeInt(character.x);
      output.writeInt(character.y);
      return true;
    } catch (IOException ex) {
View Full Code Here

    DataOutputStream output = null;
    try {
      output = new DataOutputStream(new FileOutputStream(file));
      output.writeInt(character.id);
      output.writeUTF(character.otherStuff);
      output.writeInt(character.x);
      output.writeInt(character.y);
      return true;
    } catch (IOException ex) {
      ex.printStackTrace();
      return false;
View Full Code Here

    try {
      output = new DataOutputStream(new FileOutputStream(file));
      output.writeInt(character.id);
      output.writeUTF(character.otherStuff);
      output.writeInt(character.x);
      output.writeInt(character.y);
      return true;
    } catch (IOException ex) {
      ex.printStackTrace();
      return false;
    } finally {
View Full Code Here

            // Write out the Values
            Value prevKey = null;
            for(int i = 0; i < keys.length; i++) {
                final Value v = keys[i];
                if(v == prevKey) {
                    os.writeInt(-1);
                } else {
                    final int len = v.getLength();
                    final int size = len - prefixlen;
                    os.writeInt(size);
                    if(size > 0) {
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.