Пример #1
0
 void init(String nativeHandlerName, int inputBufferCapacity, int outputBufferCapacity) {
   if (inputBufferCapacity > 0) {
     this.inputBuffer = ByteBuffer.allocateDirect(inputBufferCapacity);
     this.inputBuffer.order(ByteOrder.LITTLE_ENDIAN);
   }
   if (outputBufferCapacity > 0) {
     this.outputBuffer = ByteBuffer.allocateDirect(outputBufferCapacity);
     this.outputBuffer.order(ByteOrder.LITTLE_ENDIAN);
   }
   this.nativeHandlerAddr = NativeRuntime.createNativeObject(nativeHandlerName);
   if (this.nativeHandlerAddr == 0) {
     throw new RuntimeException("Native object create failed, class: " + nativeHandlerName);
   }
   setupHandler(nativeHandlerAddr);
 }