Class DataBlocks.BlockUploadData

java.lang.Object
org.apache.hadoop.fs.store.DataBlocks.BlockUploadData
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
DataBlocks

public static final class DataBlocks.BlockUploadData extends Object implements Closeable
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 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

      public byte[] toByteArray() throws IOException
      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

      public void close() throws IOException
      Close: closes any upload stream and byteArray provided in the constructor.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException - inherited exception.