GW2RegisterImportMemory
Fungsi GW2RegisterImportMemory mendaftarkan lokasi memori yang berisi file interchange yang diperlukan untuk impor. File interchange adalah file zip yang dihasilkan dari proses ekspor dan lokasi memori disediakan oleh GW2RegisterExportMemory. Menggunakan fungsi GW2RegisterImportMemory mengaktifkan Import Process Mode untuk session.
- C++
- C#
- Java
- Python
- JavaScript
#include "glasswall.core2.api.h"
int GW2RegisterImportMemory(Session session, char *importFileBuffer, size_t *importLength);
Parameter
session ID session seperti yang dikembalikan oleh GW2OpenSession.
importFileBuffer Lokasi memori yang berisi file interchange yang diperlukan untuk impor. Lokasi memori disediakan oleh GW2RegisterExportMemory dan file harus sesuai dengan format file interchange.
importLength Panjang importFileBuffer dalam byte
Hasil pengembalian
Mengembalikan bilangan bulat yang menunjukkan apakah pemanggilan fungsi berhasil. Angka negatif menunjukkan kegagalan. Lihat tabel Return Types untuk penjelasan kode pengembalian.
Sinopsis
public int RegisterImportMemory(
int session,
byte[] importFileBuffer)
Hasil pengembalian
Mengembalikan nilai enum GW2_RetStatus berupa integer. Angka negatif menunjukkan kegagalan.
Sinopsis
import com.glasswall.core2javabridge.*;
public int GW2RegisterImportMemory(int session, byte[] importBuffer) throws GlasswallException, NullPointerException
public int GW2RegisterImportMemory(int session, byte[] importBuffer, int length) throws GlasswallException, NullPointerException
Catatan
Lihat API Overview/Return types untuk enumerator yang valid bagi format.
length dari fileBuffer dapat ditentukan secara opsional.
Hasil pengembalian
Fungsi GW2RegisterImportMemory mengembalikan enumerasi GW2_RetStatus yang dikonversi menjadi int. Nilainya akan negatif jika terjadi kesalahan. 0 menunjukkan keberhasilan. Lihat API Overview/Return types untuk detailnya.
Exception GlasswallException akan dilempar jika session tidak valid, atau jika buffer impor tidak dapat diambil.
Exception NullPointerException akan dilempar jika buffer importBuffer bernilai null atau kosong.
Sinopsis
Mendaftarkan file .zip untuk diimpor bagi session yang diberikan. File yang dibangun akan dibuat selama pemanggilan run_session milik session.
def register_import(self, session: int, input_file: Union[str, bytes, bytearray, io.BytesIO]):
""" Registers a .zip file to be imported for the given session. The constructed file will be created during the session's run_session call.
Args:
session (int): The session integer.
input_file (Union[str, bytes, bytearray, io.BytesIO]): The input import file path or bytes.
Returns:
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attribute 'status' indicating the result of the function call. If output_file is None (memory mode), 'buffer', and 'buffer_length' are included containing the file content and file size.
"""
Hasil pengembalian
gw_return_object (glasswall.GwReturnObj): Instance GwReturnObj dengan atribut 'status' yang menunjukkan hasil pemanggilan fungsi. Jika output_file adalah None (mode memori), 'buffer' dan 'buffer_length' disertakan yang berisi konten file dan ukuran file.
Atribut status adalah nilai enum bilangan bulat GW2_RetStatus. Angka negatif menunjukkan kegagalan.
Sinopsis
Fungsi ini mendaftarkan lokasi memori impor terhadap session yang ditentukan.
/**
* @param {number} session The ID of the session.
* @param {string} importFileBuffer A pointer to the specified memory location.
* @param {number} importLength The size of the file buffer.
*/
GW2RegisterImportMemory(session, import_File_Buffer, import_File_Buffer_Length)
Hasil pengembalian
Atribut status adalah nilai enum bilangan bulat GW2_RetStatus. Angka negatif menunjukkan kegagalan.