Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    public static byte[] readStream(InputStream is) throws Exception {
        byte[] bytes = new byte[1024];
        int leng;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        while ((leng = is.read(bytes)) != -1) {
            baos.write(bytes, 0, leng);
        }
        return baos.toByteArray();
    }
}