Package java.io

Examples of java.io.DataInputStream.readFully()


        if (idFile.exists() && idFile.length() >= maxLength) {
            DataInputStream dis = null;
            try {
                final byte[] rawBytes = new byte[maxLength];
                dis = new DataInputStream(new FileInputStream(idFile));
                dis.readFully(rawBytes);
                final String rawString = new String(rawBytes, "ISO-8859-1");

                // roundtrip to ensure correct format of UUID value
                final String id = UUID.fromString(rawString).toString();
                logger.debug("Got Sling ID {} from file {}", id, idFile);
View Full Code Here


                    ZipEntry ze = jarFile.getEntry(element.toString());

                    InputStream fileStream = jarFile.getInputStream(ze);
                    byte[] data = new byte[(int) ze.getSize()];
                    DataInputStream dataIs = new DataInputStream(fileStream);
                    dataIs.readFully(data);
                    dataIs.close();
                    return data;
                }
            }
        }
View Full Code Here

        readcount ++;
        input.readByte(); // reading reserved byte
        readcount ++;

        byte dataFormatID[] = new byte[4];
        input.readFully(dataFormatID);
        readcount += 4;
        byte dataVersion[] = new byte[4];
        input.readFully(dataVersion);
        readcount += 4;
        byte unicodeVersion[] = new byte[4];
View Full Code Here

        byte dataFormatID[] = new byte[4];
        input.readFully(dataFormatID);
        readcount += 4;
        byte dataVersion[] = new byte[4];
        input.readFully(dataVersion);
        readcount += 4;
        byte unicodeVersion[] = new byte[4];
        input.readFully(unicodeVersion);
        readcount += 4;
        if (headersize < readcount) {
View Full Code Here

        readcount += 4;
        byte dataVersion[] = new byte[4];
        input.readFully(dataVersion);
        readcount += 4;
        byte unicodeVersion[] = new byte[4];
        input.readFully(unicodeVersion);
        readcount += 4;
        if (headersize < readcount) {
            throw new IOException("Internal Error: Header size error");
        }
        input.skipBytes(headersize - readcount);
View Full Code Here

                byte[] result = new byte[(int)f.length()];
               
                DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(f)));
                try {
                    dis.readFully(result);
                } finally {
                    if (dis != null) {
                        dis.close();
                    }
                }
View Full Code Here

        if(dis.readInt() != VERSION) throw new IOException("Bad version for master.keys");
        long iterations = dis.readLong();
        if(iterations < 0 || iterations > MAX_ITERATIONS) throw new IOException("Bad iterations "+iterations+" for master.keys");
       
        byte[] salt = new byte[32];
        dis.readFully(salt);
        byte[] iv = new byte[32];
        dis.readFully(iv);
        byte[] dataAndHash = new byte[length - salt.length - iv.length - 4 - 8];
        dis.readFully(dataAndHash);
//        System.err.println("Data and hash: "+HexUtil.bytesToHex(dataAndHash));
View Full Code Here

        if(iterations < 0 || iterations > MAX_ITERATIONS) throw new IOException("Bad iterations "+iterations+" for master.keys");
       
        byte[] salt = new byte[32];
        dis.readFully(salt);
        byte[] iv = new byte[32];
        dis.readFully(iv);
        byte[] dataAndHash = new byte[length - salt.length - iv.length - 4 - 8];
        dis.readFully(dataAndHash);
//        System.err.println("Data and hash: "+HexUtil.bytesToHex(dataAndHash));
        byte[] pwd = password.getBytes("UTF-8");
        MessageDigest md = SHA256.getMessageDigest();
View Full Code Here

        byte[] salt = new byte[32];
        dis.readFully(salt);
        byte[] iv = new byte[32];
        dis.readFully(iv);
        byte[] dataAndHash = new byte[length - salt.length - iv.length - 4 - 8];
        dis.readFully(dataAndHash);
//        System.err.println("Data and hash: "+HexUtil.bytesToHex(dataAndHash));
        byte[] pwd = password.getBytes("UTF-8");
        MessageDigest md = SHA256.getMessageDigest();
        md.update(pwd);
        md.update(salt);
View Full Code Here

        dis = new DataInputStream(bais);
        long flags = dis.readLong();
        // At the moment there are no interesting flags.
        // In future the flags will tell us whether the database and the datastore are encrypted.
        byte[] clientCacheKey = new byte[32];
        dis.readFully(clientCacheKey);
        byte[] databaseKey = null;
        databaseKey = new byte[32];
        dis.readFully(databaseKey);
        byte[] tempfilesMasterSecret = new byte[64];
        boolean mustWrite = false;
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.