Package java.io

Examples of java.io.DataInput.readFully()


        byte[] tableBytes;
        byte[] recordIdBytes;

        try {
            tableBytes = new byte[dataInput.readInt()];
            dataInput.readFully(tableBytes, 0, tableBytes.length);
            recordIdBytes = new byte[dataInput.readInt()];
            dataInput.readFully(recordIdBytes, 0, recordIdBytes.length);
        } catch (IOException ioe) {
            throw new RuntimeException("Error while deserializing AbsoluteRecordId", ioe);
        }
View Full Code Here


        try {
            tableBytes = new byte[dataInput.readInt()];
            dataInput.readFully(tableBytes, 0, tableBytes.length);
            recordIdBytes = new byte[dataInput.readInt()];
            dataInput.readFully(recordIdBytes, 0, recordIdBytes.length);
        } catch (IOException ioe) {
            throw new RuntimeException("Error while deserializing AbsoluteRecordId", ioe);
        }

        return new AbsoluteRecordIdImpl(new String(tableBytes), idGenerator.fromBytes(recordIdBytes));
View Full Code Here

                BufferedOutputStream fileOutput = new BufferedOutputStream(new FileOutputStream(file));

                byte[] buffer = new byte[8092];
                int length;
                while ((length = input.readInt()) > 0) {
                    input.readFully(buffer, 0, length);
                    fileOutput.write(buffer, 0, length);
                }
                fileOutput.close();

                long calculatedChecksum = crc32.getValue();
View Full Code Here

            int totalEntries = dis.readInt();
            int bitwidth = dis.readByte();
            int firstException = dis.readInt();
            int len = dis.readInt();
            byte[] b = new byte[len];
            dis.readFully(b, 0, len);
            FastByteArrayInputStream codesIs = new FastByteArrayInputStream(b);
            BitInputStream codesBis = new BitInputStream(codesIs);
            int[] codes = new int[totalEntries];
            unpack(codesBis, bitwidth, codes, totalEntries);
            int exceptions = dis.readShort();
View Full Code Here

      }

      for (int i = 0; i < numItems; i++) {
        arrays[i] = new byte[lens[i]];

        input.readFully(arrays[i]);
      }

      return arrays;
    } catch (IOException e) {
      throw new RuntimeException("shouldn't see this either", e);
View Full Code Here

    this.masterSignalToStartNextDatasetPass = in.readBoolean();
   
    int bytesToRead = in.readInt();
   
    this.dbn_payload = new byte[ bytesToRead ];
    in.readFully( this.dbn_payload, 0, bytesToRead );
   

    // this.dbn.load(b);
    //this.dbn_payload = bytes;
View Full Code Here

                {
                    // Read data from server
                    String channel = in.readUTF();
                    short len = in.readShort();
                    byte[] data = new byte[ len ];
                    in.readFully( data );

                    // Prepare new data to send
                    out.writeUTF( channel );
                    out.writeShort( data.length );
                    out.write( data );
View Full Code Here

                // Read data from server
                String target = in.readUTF();
                String channel = in.readUTF();
                short len = in.readShort();
                byte[] data = new byte[ len ];
                in.readFully( data );

                // Prepare new data to send
                out.writeUTF( channel );
                out.writeShort( data.length );
                out.write( data );
View Full Code Here

            for(;;){
                DataInput in =  phys.getDataInput(offset + c, size-c);

                if(buf.length<pos+size-c)
                    buf = Arrays.copyOf(buf,Math.max(pos+size-c,buf.length*2)); //buf to small, grow
                in.readFully(buf,pos,size-c);
                pos+=size-c;
                if(c==0) break;
                //read next part
                long next = phys.getLong(offset);
                offset = next&MASK_OFFSET;
View Full Code Here

        DataInputStream stream = (DataInputStream) mOpenStream;
        return stream.read(buf, 0, size);
      } else {
        DataInput input = (DataInput) mOpenStream;
        try {
          input.readFully(buf, 0, size);
          ret = size;
        } catch (EOFException e) {
          // man; we have no idea how many bytes were actually
          // read now... so we truncate the data
          // what a sucky interface!
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.