public class FileOutputStream extends OutputStream
Modifier | Constructor and Description |
---|---|
protected |
FileOutputStream(CloudFile parentFile,
long length,
AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Initializes a new instance of the FileOutputStream class.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this output stream and releases any system resources associated with this stream.
|
void |
flush()
Flushes this output stream and forces any buffered output bytes to be written out.
|
void |
write(byte[] data)
Writes
b.length bytes from the specified byte array to this output stream. |
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(InputStream sourceStream,
long writeLength)
Writes all data from the InputStream to the File.
|
void |
write(int byteVal)
Writes the specified byte to this output stream.
|
@DoesServiceRequest protected FileOutputStream(CloudFile parentFile, long length, AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
parentFile
- A CloudFile
object which represents the file that this stream is associated with.length
- A long
which represents the length of the file in bytes.accessCondition
- An AccessCondition
object which represents the access conditions for the file.options
- A FileRequestOptions
object which specifies any additional options for the request.opContext
- An OperationContext
object which is used to track the execution of the operationStorageException
- An exception representing any error which occurred during the operation.@DoesServiceRequest public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
- If an I/O error occurs.@DoesServiceRequest public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
- If an I/O error occurs.@DoesServiceRequest public void write(byte[] data) throws IOException
b.length
bytes from the specified byte array to this output stream.write
in class OutputStream
data
- A byte
array which represents the data to write.IOException
- If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been
closed.@DoesServiceRequest public void write(byte[] data, int offset, int length) throws IOException
write
in class OutputStream
data
- A byte
array which represents the data to write.offset
- An int
which represents the start offset in the data.length
- An int
which represents the number of bytes to write.IOException
- If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been
closed.@DoesServiceRequest public void write(InputStream sourceStream, long writeLength) throws IOException, StorageException
sourceStream
- An InputStream
object which species the data to write to the File.IOException
- If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been
closed.StorageException
- An exception representing any error which occurred during the operation.@DoesServiceRequest public void write(int byteVal) throws IOException
write
in class OutputStream
byteVal
- An int
which represents the bye value to write.IOException
- If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been
closed.Copyright © 2019. All rights reserved.