1
(short, int, long, float, double, bigint)를 바이트 배열로 변환하는 스칼라 코드를 따라 왔습니다.숫자 (short, int, long, float, double, bigint)를 바이트 배열로 변환 : Scala/Java
def getByteArray(value: Any, of_type: String) = {
of_type match {
case "short" => ByteBuffer.allocate(2).putShort(value.asInstanceOf[Short]).array()
case "int" => ByteBuffer.allocate(4).putInt(value.asInstanceOf[Int]).array()
case "long" => ByteBuffer.allocate(8).putLong(value.asInstanceOf[Long]).array()
case "float" => ByteBuffer.allocate(4).putFloat(value.asInstanceOf[Float]).array()
case "double" => ByteBuffer.allocate(8).putDouble(value.asInstanceOf[Double]).array()
case "bigint" => BigInt(value.toString).toByteArray
}
}
이 모두 필요한가요? 나는 아무의 ByteBuffer 내가
allocateDirect
방법을 사용하는 경우는 예외 아래에 발생을 누설하지가 같은
는clear()
,mark()
,reset()
보장하기 위해 마지막에있는 정리 메소드를 호출해야합니까. 그렇다면allocateDirect
메서드에 보조 배열이 없다는 뜻입니까? java.nio.ByteBuffer.array (ByteBuffer.java:994)에서 "주"스레드 java.lang.UnsupportedOperationException가 에서
예외