你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
StorageOutputStream Class
- java.
lang. Object - java.
io. OutputStream - com.
azure. storage. common. StorageOutputStream
- com.
- java.
public abstract class StorageOutputStream
extends OutputStream
StorageOutputStream allows for uploading data to an Azure Storage service using stream concepts.
Field Summary
Modifier and Type | Field and Description |
---|---|
protected volatile IOException |
lastError
Holds the last exception this stream encountered. |
Constructor Summary
Modifier | Constructor | Description |
---|---|---|
protected | StorageOutputStream(int writeThreshold) |
Creates a new instance of StorageOutputStream. |
Method Summary
Modifier and Type | Method and Description |
---|---|
protected void |
checkStreamState()
Helper function to check if the stream is faulted, if it is it surfaces the exception. |
synchronized void |
close()
Closes this output stream and releases any system resources associated with this stream. |
protected abstract Mono<Void> |
dispatchWrite(byte[] data, int writeLength, long offset)
Dispatches a write operation to the Storage service. |
void |
flush()
Flushes this output stream and forces any buffered output bytes to be written out. |
void |
write(byte[] data)
Writes |
void |
write(byte[] data, int offset, int length)
Writes length bytes from the specified byte array starting at offset to this output stream. |
void |
write(int byteVal)
Writes the specified byte to this output stream. |
protected void |
writeInternal(byte[] data, int offset, int length)
Writes the data to the buffer and triggers writes to the service as needed. |
Methods inherited from java.io.OutputStream
Methods inherited from java.lang.Object
Field Details
lastError
protected volatile IOException lastError
Holds the last exception this stream encountered.
Constructor Details
StorageOutputStream
protected StorageOutputStream(int writeThreshold)
Creates a new instance of StorageOutputStream.
Parameters:
Method Details
checkStreamState
protected void checkStreamState()
Helper function to check if the stream is faulted, if it is it surfaces the exception.
close
public synchronized void close()
Closes this output stream and releases any system resources associated with this stream. If any data remains in the buffer it is committed to the service.
Overrides:
StorageOutputStream.close()Throws:
dispatchWrite
protected abstract Mono
Dispatches a write operation to the Storage service.
Parameters:
Returns:
flush
public void flush()
Flushes this output stream and forces any buffered output bytes to be written out. If any data remains in the buffer it is committed to the service.
Overrides:
StorageOutputStream.flush()write
public void write(byte[] data)
Writes b.length
bytes from the specified byte array to this output stream.
Overrides:
StorageOutputStream.write(byte[] data)Parameters:
byte
array which represents the data to write.
write
public void write(byte[] data, int offset, int length)
Writes length bytes from the specified byte array starting at offset to this output stream.
Overrides:
StorageOutputStream.write(byte[] data, int offset, int length)Parameters:
byte
array which represents the data to write.
int
which represents the start offset in the data.
int
which represents the number of bytes to write.
write
public void write(int byteVal)
Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.
true
is acceptable for you.
Overrides:
StorageOutputStream.write(int byteVal)Parameters:
int
which represents the byte value to write.
writeInternal
protected void writeInternal(byte[] data, int offset, int length)
Writes the data to the buffer and triggers writes to the service as needed.
Parameters:
byte
array which represents the data to write.
int
which represents the start offset in the data.
int
which represents the number of bytes to write.