Class CryptoStreamUtils

java.lang.Object
org.apache.hadoop.crypto.CryptoStreamUtils

@Private public class CryptoStreamUtils extends Object
  • Constructor Details

    • CryptoStreamUtils

      public CryptoStreamUtils()
  • Method Details

    • freeDB

      public static void freeDB(ByteBuffer buffer)
      Forcibly free the direct buffer.
      Parameters:
      buffer - buffer.
    • getBufferSize

      public static int getBufferSize(Configuration conf)
      Read crypto buffer size.
      Parameters:
      conf - configuration.
      Returns:
      hadoop.security.crypto.buffer.size.
    • checkCodec

      public static void checkCodec(CryptoCodec codec)
      AES/CTR/NoPadding or SM4/CTR/NoPadding is required.
      Parameters:
      codec - crypto codec.
    • checkBufferSize

      public static int checkBufferSize(CryptoCodec codec, int bufferSize)
      Check and floor buffer size.
      Parameters:
      codec - crypto codec.
      bufferSize - the size of the buffer to be used.
      Returns:
      calc buffer size.
    • getInputStreamOffset

      public static long getInputStreamOffset(InputStream in) throws IOException
      If input stream is Seekable, return it's current position, otherwise return 0;
      Parameters:
      in - wrapper.
      Returns:
      current position, otherwise return 0.
      Throws:
      IOException - raised on errors performing I/O.