GW2RegisterInputMemory
Ang function na GW2RegisterInputMemory ay nagrerehistro ng input file na nakaimbak sa memory sa isang session.
- C++
- C#
- Java
- Python
- JavaScript
Buod
Ang function na GW2RegisterInputMemory ay nagrerehistro ng file na nakaimbak sa buffer na tinutukoy ng inputFileBuffer na may sukat na inputLength bytes, sa session na tinutukoy ng session.
#include "glasswall.core2.api.h"
int GW2RegisterInputMemory(Session session, const char *inputFileBuffer, size_t inputLength);
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Halimbawa
#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 */
Buod
public int RegisterInputMemory(
int session,
byte[] inputFileBuffer)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Buod
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
Tandaan
Ang length ng inputFileBuffer ay maaaring tukuyin bilang opsyonal.
Ibinabalik
Ang function na GW2RegisterInputMemory ay nagbabalik ng isang GW2_RetStatus enumeration na kino-convert sa int. Magiging negatibo ang value kung may naganap na error. Ang 0 ay nagpapahiwatig ng tagumpay. Sumangguni sa API Overview/Return types para sa mga detalye.
Isang GlasswallException exception ang ihahagis kung hindi wasto ang session, o kung hindi makuha ang input buffer.
Isang NullPointerException exception ang ihahagis kung ang buffer na inputFileBuffer ay null o walang laman.
Buod
Magrehistro ng isang input file o bytes para sa ibinigay na session.
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'.
"""
Ibinabalik
Isang object na may iba't ibang attribute depende sa uri ng input_file.
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): Isang instance ng GwReturnObj na may mga attribute na 'session', 'input_file', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): Isang instance ng GwReturnObj na may mga attribute na 'session', 'buffer', 'buffer_length', 'status'.
Ang status attribute ay isang integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng failure.
Buod
Ang function na ito ay nagrerehistro ng file na nakaimbak sa memory bilang input file para sa isang tinukoy na session
/**
* @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)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.