code: public static final byte[] loadByteArray(final InputStream in) {
  		try {
  			final ByteArrayOutputStream bOut = new ByteArrayOutputStream();
  
  			final byte buffer[] = new byte[2048];
  
  			int iNbByteRead = -1;
  
  			while ((iNbByteRead = in.read(buffer)) != -1) {
  				bOut.write(buffer, 0, iNbByteRead);
  			}
  
  			return bOut.toByteArray();
  		} catch (final IOException ioe) {
  			return null;
  		}
  	}
docs: load the given inputstream in a byte array
  
  @param in
  the stream to load
  
  @return a byte array