private byte[] readBuffer(InputStream data) throws IOException
	{
        byte[] buf = new byte[bufferSize];
        int len = data.read(buf);
        return len > 0 ? Arrays.copyOfRange(buf, 0, len) : null;
	}