AzureBlobOutputStream extends OutputStream { public synchronized long getSize() { return byteArrayOutputStream.isPresent() ? byteArrayOutputStream.get().size() + totalUploadedBlockSize : totalUploadedBlockSize; } AzureBlobOutputStream(BlockBlobAsyncClient blobAsyncClient, Executor blobThreadPool, AzureBlobWriterMetrics metrics,
      BlobMetadataGeneratorFactory blobMetadataGeneratorFactory, Config blobMetadataGeneratorConfig, String streamName,
      long flushTimeoutMs, int maxBlockFlushThresholdSize, Compression compression); @VisibleForTesting  AzureBlobOutputStream(BlockBlobAsyncClient blobAsyncClient, Executor blobThreadPool, AzureBlobWriterMetrics metrics,
      BlobMetadataGeneratorFactory blobMetadataGeneratorFactory, Config blobMetadataGeneratorConfig, String streamName,
      long flushTimeoutMs, int maxBlockFlushThresholdSize,
      ByteArrayOutputStream byteArrayOutputStream, Compression compression); @Override synchronized void write(int b); @Override synchronized void write(byte[] b, int off, int len); @Override synchronized void flush(); @Override synchronized void close(); synchronized long getSize(); synchronized void releaseBuffer(); synchronized void incrementNumberOfRecordsInBlob();  }
@Test public void testGetSize() throws Exception { Assert.assertEquals(0, azureBlobOutputStream.getSize()); azureBlobOutputStream.write(BYTES, 0, BYTES.length); Assert.assertEquals(BYTES.length, azureBlobOutputStream.getSize()); }