Package java.io

Examples of java.io.BufferedInputStream.available()


            public void process(Exchange exchange) throws Exception {
             // Read from an input stream
                InputStream is = new BufferedInputStream(
                    new FileInputStream("./src/test/resources/asf-logo.gif"));

                byte buffer[] = new byte[is.available()];
                int n = is.available();
                for (int i = 0; i < n; i++) {
                    buffer[i] = (byte)is.read();
                }
                 
View Full Code Here


             // Read from an input stream
                InputStream is = new BufferedInputStream(
                    new FileInputStream("./src/test/resources/asf-logo.gif"));

                byte buffer[] = new byte[is.available()];
                int n = is.available();
                for (int i = 0; i < n; i++) {
                    buffer[i] = (byte)is.read();
                }
                 
                is.close();
View Full Code Here

            public void process(Exchange exchange) throws Exception {
             // Read from an input stream
                InputStream is = new BufferedInputStream(
                    new FileInputStream("./src/test/resources/asf-logo.JPG"));

                byte buffer[] = new byte[is.available()];
                int n = is.available();
                for (int i = 0; i < n; i++) {
                    buffer[i] = (byte)is.read();
                }
               
View Full Code Here

             // Read from an input stream
                InputStream is = new BufferedInputStream(
                    new FileInputStream("./src/test/resources/asf-logo.JPG"));

                byte buffer[] = new byte[is.available()];
                int n = is.available();
                for (int i = 0; i < n; i++) {
                    buffer[i] = (byte)is.read();
                }
               
                is.close();
View Full Code Here

        }
        // put file into buffer
        bis = new BufferedInputStream(fis);
        bos = new BufferedOutputStream(fos);
        try { // read file, write and close
            b = new byte[bis.available()];
            bis.read(b);
            bos.write(b);
            bis.close();
            bos.close();
            file_copied = true;
View Full Code Here

      {
        exe_in = new BufferedInputStream(new FileInputStream(new File(avmplus_exe)));
       
        int abc_length = bytes.size();
       
        int avmplus_exe_length = exe_in.available();
        byte avmplus_exe_bytes[] = new byte[avmplus_exe_length];
        exe_in.read(avmplus_exe_bytes);
               
        exe_out = new BufferedOutputStream(new FileOutputStream(new File(pathspec, scriptname + ".exe")));
       
View Full Code Here

    private void testFailed() {
        ++numErrors;

        try {
            InputStream input = new BufferedInputStream(new FileInputStream(outputFile));
            int length = input.available();
            byte[] b = new byte[length];
            input.read(b, 0, length);
            writeTestProblems(testName, new String(b));
        }
        catch (IOException e) {
View Full Code Here

        }
        // put file into buffer
        bis = new BufferedInputStream(fis);
        bos = new BufferedOutputStream(fos);
        try { // read file, write and close
            b = new byte[bis.available()];
            bis.read(b);
            bos.write(b);
            bis.close();
            bos.close();
            file_copied = true;
View Full Code Here

        // read the request
        InputStream in = new BufferedInputStream(s.getInputStream());
        byte command = (byte)in.read();
        byte[] lengthb = new byte[4];
        while(in.available() < 4);
        in.read(lengthb);
        int length = SimpleP2P.byteArray2int(lengthb);
        int answer = SimpleP2P.REPLY_ERROR;

        if (length > 0)
View Full Code Here

        int answer = SimpleP2P.REPLY_ERROR;

        if (length > 0)
        {
          byte[] data = new byte[length];
          while(in.available() < length);
          in.read(data);

          // process the request
          switch (command)
          {
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.