public byte[] getTail() {
        int size = (int) Math.min(tailSize, bytesRead);
        byte[] result = new byte[size];
        System.arraycopy(tailBuffer, currentIndex, result, 0, size - currentIndex);
        System.arraycopy(tailBuffer, 0, result, size - currentIndex, currentIndex);
        return result;
    }
@Test
    public void testTailSingleByteReads() throws IOException {
        final int count = 128;
        TailStream stream = new TailStream(generateStream(0, 2 * count), count);
        readStream(stream);
        assertEquals(generateText(count, count), new String(stream.getTail(), UTF_8),
                "Wrong buffer");
    }