Package java.io

Examples of java.io.DataInputStream.readFully()


    FileInputStream fileInputStream = new FileInputStream(licenseFile);
    DataInputStream dataInputStream = new DataInputStream(fileInputStream);
    try {
      returnByteArray = new byte[fileInputStream.available()];
      dataInputStream.readFully(returnByteArray);
    } finally {
      dataInputStream.close();
      fileInputStream.close();
    }
    return returnByteArray;
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

                state = STATE_REGULAR;
                int len = dataIn.readInt();
                dataOut.writeInt(len);
                len -= 4;
                byte[] data = new byte[len];
                dataIn.readFully(data, 0, len);
                dataOut.write(data);
                dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
                int version = dataIn.readInt();
                if (version == 80877102) {
                    println("CancelRequest");
View Full Code Here

                dataOut.write(x);
                int len = dataIn.readInt();
                dataOut.writeInt(len);
                len -= 4;
                byte[] data = new byte[len];
                dataIn.readFully(data, 0, len);
                dataOut.write(data);
                dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
                switch (x) {
                case 'B': {
                    println("Bind");
View Full Code Here

                    int paramCount = dataIn.readShort();
                    for (int i = 0; i < paramCount; i++) {
                        int paramLen = dataIn.readInt();
                        println(" length[" + i + "]=" + paramLen);
                        byte[] d2 = new byte[paramLen];
                        dataIn.readFully(d2);
                    }
                    int resultCodeCount = dataIn.readShort();
                    for (int i = 0; i < resultCodeCount; i++) {
                        println(" resultCodeCount[" + i + "]=" + dataIn.readShort());
                    }
View Full Code Here

            dataOut.write(x);
            int len = dataIn.readInt();
            dataOut.writeInt(len);
            len -= 4;
            byte[] data = new byte[len];
            dataIn.readFully(data, 0, len);
            dataOut.write(data);
            dataIn = new DataInputStream(new ByteArrayInputStream(data, 0, len));
            switch (x) {
            case 'R': {
                println("Authentication");
View Full Code Here

            try {
                filter = dataStream.read();
                if (filter < 0) {
                    return fout.toByteArray();
                }
                dataStream.readFully(curr, 0, bytesPerRow);
            } catch (Exception e) {
                return fout.toByteArray();
            }

            switch (filter) {
View Full Code Here

        long length = customerLogo.length();
        // make sure the long isn't bigger than maximum int value.
        if (length <= Integer.MAX_VALUE)
        {
          buffer = new byte[(int)length];
          customerLogoStream.readFully(buffer);
          // Cache the data.
          siteInfo.setCustomerLogoData(buffer);
          siteInfo.setCustomerLogoDirty(false);
          size = buffer.length;
        }
View Full Code Here

            } else {
                javacProcess(javaFile);
            }
            byte[] data = new byte[(int) classFile.length()];
            DataInputStream in = new DataInputStream(new FileInputStream(classFile));
            in.readFully(data);
            in.close();
            return data;
        } catch (Exception e) {
            throw DbException.convert(e);
        } finally {
View Full Code Here

                long length = file.length();
                if (length < Integer.MAX_VALUE) {
                    byte[] classbytes = new byte[(int)length];
                    DataInputStream in =
                        new DataInputStream(new FileInputStream(file));
                    in.readFully(classbytes);
                    in.close();
                    Class c = defineClass(null, classbytes, 0, (int) length);
                    if (c != null) {
                        resolveClass(c);
                        return c;
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.