Examples of readFully()


Examples of java.io.DataInputStream.readFully()

                DataInputStream dis = new DataInputStream(verifyKeyInputStream);
        // then read the checksum length
        int checksumLen = dis.readInt();

        byte[] originalChecksum = new byte[checksumLen];
        dis.readFully(originalChecksum);

        dis.readFully(data);

        // decrypt data with key
        CipherProvider tmpCipherProvider = createNewCipher(DECRYPT,mainSecretKey,mainIV);
View Full Code Here

Examples of java.io.DataInputStream.readFully()

        int checksumLen = dis.readInt();

        byte[] originalChecksum = new byte[checksumLen];
        dis.readFully(originalChecksum);

        dis.readFully(data);

        // decrypt data with key
        CipherProvider tmpCipherProvider = createNewCipher(DECRYPT,mainSecretKey,mainIV);
        tmpCipherProvider.decrypt(data, 0, data.length, data, 0);
View Full Code Here

Examples of java.io.InputStream.readFully()

                        // Hmm, kind of dangerous to do this
                        byte[] fileBArray = new byte[(int) fs.getFileStatus(
                                file).getLen()];
                        try {
                            FSDataInputStream fis = fs.open(file);
                            fis.readFully(0, fileBArray);
                            fis.close();
                            key.set(URI);
                            // fill the values for the content object
                            value.setUrl(URI);
                            value.setContent(fileBArray);
View Full Code Here

Examples of java.io.ObjectInputStream.readFully()

        if (i > 10 && i % (1000000 / 10) == 0)
          System.out.print(".");

        buffer = new byte[size];
        oiStream.readFully(buffer);
        transferred += size;

        ooStream.writeByte(0);
        ooStream.flush();
        oStream.flush();
View Full Code Here

Examples of java.io.RandomAccessFile.readFully()

            long len = ra.length();
            if (len >= Integer.MAX_VALUE) {
                throw new RuntimeException("File " + file.getPath() + " is too large");
            }
            byte[] buffer = new byte[(int) len];
            ra.readFully(buffer);
            ra.close();
            return buffer;
        } catch (IOException e) {
            throw new RuntimeException("Error reading from file " + file, e);
        }
View Full Code Here

Examples of java.io.RandomAccessFile.readFully()

        String fileName = baseDir + "/" + className.replace('.', '/') + ".java";
        current = new ParseState();
        try {
            RandomAccessFile file = new RandomAccessFile(fileName, "r");
            byte[] buff = new byte[(int) file.length()];
            file.readFully(buff);
            source = new String(buff, "UTF-8");
            file.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of java.io.RandomAccessFile.readFully()

                    int len = random.nextInt(1000);
                    len = (int) Math.min(len, ra.length() - ra.getFilePointer());
                    byte[] b1 = new byte[len];
                    byte[] b2 = new byte[len];
                    trace("readFully " + len);
                    ra.readFully(b1, 0, len);
                    f.readFully(b2, 0, len);
                    buff.append("readFully " + len + "\n");
                    assertEquals(b1, b2);
                    break;
                }
View Full Code Here

Examples of java.io.RandomAccessFile.readFully()

    data = new byte[(int)raFile.length()];
    buf.setData(data);
      }

      // Read the entire JPEG image from the file.
      raFile.readFully(data, 0, (int)raFile.length());

      System.err.println("    read " + raFile.length() + " bytes.");

      buf.setOffset(0);
      buf.setLength((int)raFile.length());
View Full Code Here

Examples of java.io.RandomAccessFile.readFully()

        }
        final RandomAccessFile raf = new RandomAccessFile(file, "r");
        final byte[] a = new byte[mb];
        try {
            raf.seek(0);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
            raf.seek(fl - mb);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
            digest.update(NaturalOrder.encodeLong(fl, 8), 0, 8);
View Full Code Here

Examples of java.io.RandomAccessFile.readFully()

        try {
            raf.seek(0);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
            raf.seek(fl - mb);
            raf.readFully(a, 0, mb);
            digest.update(a, 0, mb);
            digest.update(NaturalOrder.encodeLong(fl, 8), 0, 8);
            if (includeDate) digest.update(NaturalOrder.encodeLong(file.lastModified(), 8), 0, 8);
        } finally {
            raf.close();
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.