public void setBuffer(byte[] buffer, int off, int len) {
        setSegment(MemorySegmentFactory.wrap(buffer), off, len);
    }
@Test
    void testSetBuffer() {
        ByteArrayInputStreamWithPos in = new ByteArrayInputStreamWithPos();
        assertThat(in.read()).isEqualTo(-1);
        byte[] testData = new byte[] {0x42, 0x43, 0x44, 0x45};
        int off = 1;
        int len = 2;
        in.setBuffer(testData, off, len);
        for (int i = 0; i < len; ++i) {
            assertThat(in.read()).isEqualTo(testData[i + off]);
        }
        assertThat(in.read()).isEqualTo(-1);
    }