Code example for ByteArrayOutputStream

Methods: closetoStringwrite

    // create a buffer that has the same size as the InputStream 
    byte[] buffer = new byte[iS.available()];
    // read the text file as a stream, into the buffer;
    // create a output stream to write the buffer into 
    ByteArrayOutputStream oS = new ByteArrayOutputStream();
    // write this buffer to the output stream 
    // Close the Input and Output streams 
    // return the output stream as a String 
    return oS.toString();
  public class TrendingUsersAdapter extends PagerAdapter { 
    private final String           TAG         = TrendingUsersAdapter.class.getSimpleName();
    private ImageThreadLoader      imageLoader = new ImageThreadLoader();
    private List<TrendingUserItem> trendingUserItems;