Package java.io

Examples of java.io.DataInput.readFully()


            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


      actualLen = di.readInt();
      baseRevision = di.readInt();
      linkRevision = di.readInt();
      parent1Revision = di.readInt();
      parent2Revision = di.readInt();
      di.readFully(nodeid, 1, 20);
      dis.skipBytes(12);
      // CAN'T USE skip() here without extra precautions. E.g. I ran into situation when
      // buffer was 8192 and BufferedInputStream was at position 8182 before attempt to skip(12).
      // BIS silently skips available bytes and leaves me two extra bytes that ruin the rest of the code.
      data = new byte[compressedLen];
View Full Code Here

      // CAN'T USE skip() here without extra precautions. E.g. I ran into situation when
      // buffer was 8192 and BufferedInputStream was at position 8182 before attempt to skip(12).
      // BIS silently skips available bytes and leaves me two extra bytes that ruin the rest of the code.
      data = new byte[compressedLen];
      if (inlineData) {
        di.readFully(data);
      } else if (needRevData) {
        dataStream.position(offset);
        dataStream.read(ByteBuffer.wrap(data));
      }
      if (needRevData) {
View Full Code Here

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

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

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

  {
    DataInput in = getInput();
    byte[] row = new byte[getBytesPerRow()];
    for (int y = getY1(); y <= getY2(); y++)
    {
      in.readFully(row);
      putBytes(row, 0, row.length);
    }
  }

  public Integer[] getCompressionTypes()
View Full Code Here

        byte value = in.readByte();
        if (value >= 0)
        {
          int numSamples = value + 1;
          // copy bytes literally
          in.readFully(row, index, numSamples);
          index += numSamples;
        }
        else
        if (value != (byte)-128)
        {
View Full Code Here

                    in.mark(16);
                    try {
                        reclen = jpeg.readSegmentLength();
                        // Check for ICC profile
                        byte[] iccString = new byte[11];
                        din.readFully(iccString);
                        din.skipBytes(1); //string terminator (null byte)

                        if ("ICC_PROFILE".equals(new String(iccString, "US-ASCII"))) {
                            skipICCProfile = (this.image.getICCProfile() != null);
                        }
View Full Code Here

                    out.write((reclen >>> 0) & 0xFF);
                    int left = reclen - 2;
                    byte[] buf = new byte[2048];
                    while (left > 0) {
                        int part = Math.min(buf.length, left);
                        din.readFully(buf, 0, part);
                        out.write(buf, 0, part);
                        left -= part;
                    }
                }
            }
View Full Code Here

        in.close();
       
        // re-open the stream and load the contents
        DataInput din = new DataInputStream(Setup.class.getResourceAsStream("Setup.class"));
        din.skipBytes(start);
        din.readFully(payload);

        // de-scramble
        for( i=0; i<payload.length; i++ )
            payload[i] ^= 0xAA;
       
View Full Code Here

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

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

                final long calculatedChecksum = crc32.getValue();
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.