package com.persagy.cameractl.controller; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import com.persagy.cameractl.cvr.HCNetSDK.FRemoteConfigCallBack; import com.sun.jna.Pointer; /** * * @version 1.0.0 * @company persagy * @author zhangqiankun * @date 2022年6月24日 下午12:48:42 */ public class RemoteConfigCallBack implements FRemoteConfigCallBack { private FileOutputStream outputStream; public RemoteConfigCallBack(FileOutputStream outputStream) { this.outputStream = outputStream; } @Override public void invoke(int dwType, Pointer lpBuffer, int dwBufLen, Pointer pUserData) { long offset = 0; ByteBuffer buffers = pUserData.getByteBuffer(offset, dwBufLen); byte[] bytes = new byte[dwBufLen]; buffers.rewind(); buffers.get(bytes); try { outputStream.write(bytes); } catch (IOException e) { e.printStackTrace(); } } }