GW2RegisterInputMemory
Fungsi GW2RegisterInputMemory mendaftarkan file input yang disimpan di memori ke sebuah sesi.
- C++
- C#
- Java
- Python
- JavaScript
Sinopsis
Fungsi GW2RegisterInputMemory mendaftarkan file yang disimpan dalam buffer yang ditunjuk oleh inputFileBuffer dengan ukuran inputLength byte, ke sesi yang ditandai oleh session.
#include "glasswall.core2.api.h"
int GW2RegisterInputMemory(Session session, const char *inputFileBuffer, size_t inputLength);
Hasil pengembalian
Mengembalikan nilai enum GW2_RetStatus berupa integer. Angka negatif menunjukkan kegagalan.
Contoh
#include "glasswall.core2.api.h"
...
HANDLE session = GW2OpenSession();
if (!session)
/* deal with error */
else
{
/* ... load file contents into buffer 'buf' and log the file size in 'size' ... */
if (GW2RegisterInputMemory(session, buf, size))
/* deal with error */
else
/* continue processing */
...
}
/* later */
if (GW2CloseSession(session))
/* error closing session */
Sinopsis
public int RegisterInputMemory(
int session,
byte[] inputFileBuffer)
Hasil pengembalian
Mengembalikan nilai enum GW2_RetStatus berupa integer. Angka negatif menunjukkan kegagalan.
Sinopsis
import com.glasswall.core2javabridge.*;
public int GW2RegisterInputMemory(int session, byte[] inputFileBuffer) throws GlasswallException, NullPointerException
public int GW2RegisterInputMemory(int session, byte[] inputFileBuffer, int length) throws GlasswallException, NullPointerException
Catatan
length dari inputFileBuffer dapat ditentukan secara opsional.
Hasil pengembalian
Fungsi GW2RegisterInputMemory mengembalikan enumerasi GW2_RetStatus yang dikonversi menjadi int. Nilainya akan negatif jika terjadi error. 0 menunjukkan keberhasilan. Lihat API Overview/Return types untuk detailnya.
Exception GlasswallException akan dilempar jika session tidak valid, atau jika buffer input tidak dapat diambil.
Exception NullPointerException akan dilempar jika buffer inputFileBuffer bernilai null atau kosong.
Sinopsis
Daftarkan file input atau byte untuk session yang diberikan.
def register_input(self, session: int, input_file: Union[str, bytes, bytearray, io.BytesIO]):
""" Register an input file or bytes for the given session.
Args:
session (int): The session integer.
input_file (Union[str, bytes, bytearray, io.BytesIO]): The input file path or bytes.
Returns:
- result (glasswall.GwReturnObj): Depending on the input 'input_file':
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'status'.
"""
Hasil pengembalian
Sebuah objek dengan atribut yang berbeda tergantung pada tipe input_file.
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): Instance GwReturnObj dengan atribut 'session', 'input_file', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): Instance GwReturnObj dengan atribut 'session', 'buffer', 'buffer_length', 'status'.
Atribut status adalah nilai enum bilangan bulat GW2_RetStatus. Angka negatif menunjukkan kegagalan.
Sinopsis
Fungsi ini mendaftarkan file yang disimpan di memori sebagai file input untuk sesi yang ditentukan
/**
* @param {number} session The ID of the session.
* @param {string} inputFileBuffer A buffer holding the file data
* @param {number} inputLength The size of the file buffer
*/
GW2RegisterInputMemory(session, inputFileBuffer, inputLength)
Hasil pengembalian
Mengembalikan nilai enum GW2_RetStatus berupa integer. Angka negatif menunjukkan kegagalan.