Package org.apache.hadoop.fs.store
Class DataBlocks.BlockUploadData
java.lang.Object
org.apache.hadoop.fs.store.DataBlocks.BlockUploadData
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- DataBlocks
The output information for an upload.
It can be one of a file, an input stream or a byteArray.
toByteArray() method to be used to convert the data into byte
array to be done in this class as well.
When closed, any stream is closed. Any source file is untouched.-
Constructor Summary
ConstructorsConstructorDescriptionBlockUploadData(byte[] byteArray) Constructor for byteArray upload data block. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close: closes any upload stream and byteArray provided in the constructor.byte[]Convert to a byte array.
-
Constructor Details
-
BlockUploadData
public BlockUploadData(byte[] byteArray) Constructor for byteArray upload data block. File and uploadStream would be null.- Parameters:
byteArray- byteArray used to construct BlockUploadData.
-
-
Method Details
-
toByteArray
Convert to a byte array. If the data is stored in a file, it will be read and returned. If the data was passed in via an input stream (which happens if the data is stored in a bytebuffer) then it will be converted to a byte array -which will then be cached for any subsequent use.- Returns:
- byte[] after converting the uploadBlock.
- Throws:
IOException- throw if an exception is caught while reading File/InputStream or closing InputStream.
-
close
Close: closes any upload stream and byteArray provided in the constructor.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- inherited exception.
-