Package java.io

Examples of java.io.DataOutputStream.writeFloat()


    public static void writeFloat(boolean[][][] data,String outputFile) throws IOException{
      DataOutputStream out = new DataOutputStream(new FileOutputStream(outputFile));
      for(int i=0; i<data.length; ++i){
        for(int j=0; j<data[i].length; ++j){
          for(int k=0; k<data[i][j].length; ++k)
          out.writeFloat(data[i][j][k]?1:0);
        }
      }
      out.close();
    }
   
View Full Code Here


      DataOutputStream output = new DataOutputStream(dout);
      try {
        if (value instanceof Double) {
          output.writeDouble(value.doubleValue());
        } else if (value instanceof Float) {
          output.writeFloat(value.floatValue());
        } else if (value instanceof Integer) {
          output.writeInt(value.intValue());
        } else if (value instanceof Short) {
          output.writeShort(value.shortValue());
        } else if (value instanceof Long) {
View Full Code Here

            canon.writeDouble(v);
        }
        {
            float v = (float) rnd.nextDouble();
            test.writeFloat(v);
            canon.writeFloat(v);
        }

        // 27
        return new DataInputStream(new ByteArrayInputStream(bos.toByteArray()));
    }
View Full Code Here

        DatagramSocket socket = new DatagramSocket(inPort.getNumber(), InetAddress.getLocalHost());

        // prepare outgoing packet
        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
        DataOutputStream dataOut = new DataOutputStream(bytesOut);
        dataOut.writeFloat(1.0f);
        dataOut.writeFloat(2.0f);
        byte[] bytesToSend = bytesOut.toByteArray();

        DatagramPacket outboundPacket = new DatagramPacket(bytesToSend, bytesToSend.length,
            InetAddress.getLocalHost(), outPort.getNumber());
View Full Code Here

        // prepare outgoing packet
        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
        DataOutputStream dataOut = new DataOutputStream(bytesOut);
        dataOut.writeFloat(1.0f);
        dataOut.writeFloat(2.0f);
        byte[] bytesToSend = bytesOut.toByteArray();

        DatagramPacket outboundPacket = new DatagramPacket(bytesToSend, bytesToSend.length,
            InetAddress.getLocalHost(), outPort.getNumber());
        socket.send(outboundPacket);
View Full Code Here

            socket = new DatagramSocket();

            // prepare outgoing packet
            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
            DataOutputStream dataOut = new DataOutputStream(bytesOut);
            dataOut.writeFloat(1.0f);
            dataOut.writeFloat(2.0f);
            byte[] bytesToSend = bytesOut.toByteArray();

            DatagramPacket outboundPacket = new DatagramPacket(bytesToSend, bytesToSend.length,
                InetAddress.getLocalHost(), outPort);
View Full Code Here

            // prepare outgoing packet
            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
            DataOutputStream dataOut = new DataOutputStream(bytesOut);
            dataOut.writeFloat(1.0f);
            dataOut.writeFloat(2.0f);
            byte[] bytesToSend = bytesOut.toByteArray();

            DatagramPacket outboundPacket = new DatagramPacket(bytesToSend, bytesToSend.length,
                InetAddress.getLocalHost(), outPort);
            socket.send(outboundPacket);
View Full Code Here

        case EMBEDDEDSET:
          break;
        case FLOAT:
          out.writeBoolean(value != null);
          if (value != null)
            out.writeFloat((Float) value);
          break;
        case INTEGER:
          out.writeBoolean(value != null);
          if (value != null)
            out.writeInt((Integer) value);
View Full Code Here

        dos.writeLong(l);
        break;

      case FLOAT:
        float f = ((FloatObjectInspector) oi).get(o);
        dos.writeFloat(f);
        break;

      case DOUBLE:
        double d = ((DoubleObjectInspector) oi).get(o);
        dos.writeDouble(d);
View Full Code Here

        dos.writeLong(l);
        break;

      case FLOAT:
        float f = ((FloatObjectInspector) oi).get(o);
        dos.writeFloat(f);
        break;

      case DOUBLE:
        double d = ((DoubleObjectInspector) oi).get(o);
        dos.writeDouble(d);
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.