@Override
  // Exposes internal mutable reference by design - Spotbugs is right to warn that this is dangerous
  public synchronized byte[] toByteArray() {
    // Note: count == buf.length is not a correct criteria to "return buf;", because the internal
    // buf may be reused after reset().
    if (!isFallback && count > 0) {
      return buf;
    } else {
      return super.toByteArray();
    }
  }
@Test
  public void testWriteSingleArrayWithLength() {
    writeToBoth(TEST_DATA, 0, TEST_DATA.length);
    assertStreamContentsEquals(stream, exposedStream);
    assertNotSame(TEST_DATA, exposedStream.toByteArray());
  }