Examples of readFully()


Examples of java.io.DataInputStream.readFully()

      byte addr[];

      switch(addrType){
         case SOCKS_ATYP_IPV4:
            addr = new byte[4];
            di.readFully(addr);
            host = bytes2IPV4(addr,0);
         break;
         case SOCKS_ATYP_IPV6:
           addr = new byte[SOCKS_IPV6_LENGTH];//I believe it is 16 bytes,huge!
           di.readFully(addr);
View Full Code Here

Examples of java.io.DataInputStream.readFully()

            di.readFully(addr);
            host = bytes2IPV4(addr,0);
         break;
         case SOCKS_ATYP_IPV6:
           addr = new byte[SOCKS_IPV6_LENGTH];//I believe it is 16 bytes,huge!
           di.readFully(addr);
           host = bytes2IPV6(addr,0);
         break;
         case SOCKS_ATYP_DOMAINNAME:
           //System.out.println("Reading ATYP_DOMAINNAME");
           addr = new byte[di.readUnsignedByte()];//Next byte shows the length
View Full Code Here

Examples of java.io.DataInputStream.readFully()

           host = bytes2IPV6(addr,0);
         break;
         case SOCKS_ATYP_DOMAINNAME:
           //System.out.println("Reading ATYP_DOMAINNAME");
           addr = new byte[di.readUnsignedByte()];//Next byte shows the length
           di.readFully(addr);
           host = new String(addr);
         break;
         default:
            throw(new SocksException(Proxy.SOCKS_JUST_ERROR));
      }
View Full Code Here

Examples of java.io.DataInputStream.readFully()

                        int len = stream.readUnsignedByte();

                        byte[] desc = new byte[len];

                        stream.readFully(desc);

                        String descStr = new String(desc, "UTF-8");

                        SourceDescription description =
View Full Code Here

Examples of java.io.DataInputStream.readFully()

        InputStream is = socket.getInputStream();
        dataIn = new DataInputStream(is);
        inLength = dataIn.readUnsignedShort();
        in = new byte[inLength];
        dataIn.readFully(in);

        Message query;
        byte[] response = null;
        try {
          query = new Message(in);
View Full Code Here

Examples of java.io.DataInputStream.readFully()

                    final File f = new File(System.getProperty("user.dir"), classname + ".class");
                    final int length = (int) f.length();
                    final byte[] classbytes = new byte[length];
                    try {
                        final DataInputStream in = new DataInputStream(new FileInputStream(f));
                        in.readFully(classbytes);
                        in.close();
                        c = defineClass(classname, classbytes, 0, classbytes.length);
                    } catch (final FileNotFoundException ee) {
                        throw new ClassNotFoundException();
                    } catch (final IOException ee) {
View Full Code Here

Examples of java.io.DataInputStream.readFully()

    private static InputStream getStream(String fileName) throws Exception {

        FileInputStream fis = new FileInputStream(fileName);
        DataInputStream dis = new DataInputStream(fis);
        byte[] bytes = new byte[dis.available()];
        dis.readFully(bytes);
        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
        return bais;
    }
   
    /**
 
View Full Code Here

Examples of java.io.DataInputStream.readFully()

        out.write(sourceData2);
        out.close();
        DataInputStream in = new DataInputStream(tmp.getInputStream());
        byte[] data1 = new byte[sourceData1.length];
        byte[] data2 = new byte[sourceData2.length];
        in.readFully(data1);
        in.mark(sourceData2.length);
        in.readFully(data2);
        in.reset();
        in.readFully(data2);
        assertTrue(Arrays.equals(sourceData1, data1));
View Full Code Here

Examples of java.io.DataInputStream.readFully()

        DataInputStream in = new DataInputStream(tmp.getInputStream());
        byte[] data1 = new byte[sourceData1.length];
        byte[] data2 = new byte[sourceData2.length];
        in.readFully(data1);
        in.mark(sourceData2.length);
        in.readFully(data2);
        in.reset();
        in.readFully(data2);
        assertTrue(Arrays.equals(sourceData1, data1));
        assertTrue(Arrays.equals(sourceData2, data2));
    }
View Full Code Here

Examples of java.io.DataInputStream.readFully()

        byte[] data2 = new byte[sourceData2.length];
        in.readFully(data1);
        in.mark(sourceData2.length);
        in.readFully(data2);
        in.reset();
        in.readFully(data2);
        assertTrue(Arrays.equals(sourceData1, data1));
        assertTrue(Arrays.equals(sourceData2, data2));
    }
   
    private void testReadFrom(int size) throws IOException {
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.