@Override
  public PositionOutputStream createOrOverwrite() {
    return new OSSOutputStream(client(), uri(), aliyunProperties(), metrics());
  }
@Test
  public void testCreateOrOverwrite() throws IOException {
    OSSURI uri = randomURI();
    int dataSize = 8;
    byte[] data = randomData(dataSize);

    writeOSSData(uri, data);

    int expectSize = 1024;
    byte[] expect = randomData(expectSize);

    OutputFile out = OSSOutputFile.fromLocation(ossClient, uri.location(), aliyunProperties);
    try (OutputStream os = out.createOrOverwrite();
        InputStream is = new ByteArrayInputStream(expect)) {
      ByteStreams.copy(is, os);
    }
    assertThat(ossDataLength(uri))
        .as(String.format("Should overwrite object length from %d to %d", dataSize, expectSize))
        .isEqualTo(expectSize);

    byte[] actual = ossDataContent(uri, expectSize);
    assertThat(actual).as("Should overwrite object content").isEqualTo(expect);
  }