Android InputStream Read readFully(InputStream inputStream)

Here you can find the source of readFully(InputStream inputStream)

Description

read Fully

License

Open Source License

Declaration

public static byte[] readFully(InputStream inputStream)
            throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static byte[] readFully(InputStream inputStream)
            throws IOException {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        int byteCount;
        byte[] buffer = new byte[1024];

        while ((byteCount = inputStream.read(buffer)) != -1) {
            os.write(buffer, 0, byteCount);
        }/*from ww w  .  j  av  a2 s .c o m*/

        return os.toByteArray();
    }
}

Related

  1. readAllAndClose(InputStream is)
  2. readAllBytes(InputStream in)
  3. readAllBytesToOutput(InputStream is, OutputStream output)
  4. readAllNoClose(InputStream is)
  5. readBSInt(InputStream is)
  6. readFullyAndClose(InputStream is)
  7. readInputStream(InputStream inStream)
  8. readInputStream(InputStream inputStream)
  9. readInputStream(InputStream is)