parquet-common/src/main/java/org/apache/parquet/bytes/BytesUtils.java
public static void writeIntLittleEndianPaddedOnBitWidth(OutputStream out, int v, int bitWidth)
      throws IOException {

    int bytesWidth = paddedByteCountFromBits(bitWidth);
    switch (bytesWidth) {
      case 0:
        break;
      case 1:
        writeIntLittleEndianOnOneByte(out, v);
        break;
      case 2:
        writeIntLittleEndianOnTwoBytes(out, v);
        break;
      case 3:
        writeIntLittleEndianOnThreeBytes(out, v);
        break;
      case 4:
        writeIntLittleEndian(out, v);
        break;
      default:
        throw new IOException(
          String.format("Encountered value (%d) that requires more than 4 bytes", v));
    }
  }
public static void writeIntLittleEndianPaddedOnBitWidth(OutputStream out, int v, int bitWidth)
      throws IOException {

    int bytesWidth = paddedByteCountFromBits(bitWidth);
    switch (bytesWidth) {
      case 0:
        break;
      case 1:
        writeIntLittleEndianOnOneByte(out, v);
        break;
      case 2:
        writeIntLittleEndianOnTwoBytes(out, v);
        break;
      case 3:
        writeIntLittleEndianOnThreeBytes(out, v);
        break;
      case 4:
        writeIntLittleEndian(out, v);
        break;
      default:
        throw new IOException(
          String.format("Encountered value (%d) that requires more than 4 bytes", v));
    }
  }
public static void writeIntLittleEndianPaddedOnBitWidth ( OutputStream out , int v , int bitWidth ) throws IOException { int bytesWidth = paddedByteCountFromBits ( bitWidth ) ; switch ( bytesWidth ) { case 0 : break ; case 1 : writeIntLittleEndianOnOneByte ( out , v ) ; break ; case 2 : writeIntLittleEndianOnTwoBytes ( out , v ) ; break ; case 3 : writeIntLittleEndianOnThreeBytes ( out , v ) ; break ; case 4 : writeIntLittleEndian ( out , v ) ; break ; default : throw new IOException ( String . format ( "Encountered value (%d) that requires more than 4 bytes" , v ) ) ; } }
Write a little endian int to out, using the the number of bytes required by
bit width
@param out an output stream
@param v an int value
@param bitWidth bit width for padding
@throws IOException if there is an exception while writing
Write a little endian int to out using the the number of bytes required by bit width @param out an output stream @param v an int value @param bitWidth bit width for padding @throws IOException if there is an exception while writing