int last = 0;   for (int j = 0; j < points.length; ++j) { int point = points[j];    os.write(bytes, last, point - last); last = point; os.flush(); Thread.sleep(PAUSE);   message.append(" point #" + (j + 1) + ": " + point); }     os.write(bytes, last, bytes.length - last); os.flush(); Thread.sleep(PAUSE);
writeFragments(bytes, points, message, os, false);
    private void writeFragments(byte[] bytes, int[] points,                                StringBuffer message, OutputStream os)                         throws IOException, InterruptedException    {        int last = 0;        // Write out the fragments        for (int j = 0; j < points.length; ++j) {            int point = points[j];            //String dump = new String(bytes,last,point-last);            //System.err.println("\nFragment "+j+"='"+dump+"'");            os.write(bytes, last, point - last);            last = point;            os.flush();            Thread.sleep(PAUSE);            // Update the log message            message.append(" point #" + (j + 1) + ": " + point);        }        // Write the last fragment        //String dump = new String(bytes,last,bytes.length-last);        //System.err.println("\nFragment N='"+dump+"'");        os.write(bytes, last, bytes.length - last);        os.flush();        Thread.sleep(PAUSE);    }