GW2RegisterInputMemory
Hàm GW2RegisterInputMemory đăng ký tệp đầu vào được lưu trong bộ nhớ vào một phiên.
- C++
- C#
- Java
- Python
- JavaScript
Tóm tắt
Hàm GW2RegisterInputMemory đăng ký tệp được lưu trong bộ đệm mà inputFileBuffer trỏ tới, có kích thước inputLength byte, với phiên được biểu thị bởi session.
#include "glasswall.core2.api.h"
int GW2RegisterInputMemory(Session session, const char *inputFileBuffer, size_t inputLength);
Giá trị trả về
Trả về một giá trị enum GW2_RetStatus dạng số nguyên. Các số âm cho biết thất bại.
Ví dụ
#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 */
Tóm tắt
public int RegisterInputMemory(
int session,
byte[] inputFileBuffer)
Giá trị trả về
Trả về một giá trị enum GW2_RetStatus dạng số nguyên. Các số âm cho biết thất bại.
Tóm tắt
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
Lưu ý
length của inputFileBuffer có thể được chỉ định tùy chọn.
Giá trị trả về
Hàm GW2RegisterInputMemory trả về một giá trị liệt kê GW2_RetStatus được chuyển đổi thành int. Giá trị sẽ là số âm nếu xảy ra lỗi. 0 cho biết thành công. Tham khảo API Overview/Return types để biết chi tiết.
Một ngoại lệ GlasswallException sẽ được đưa ra nếu session không hợp lệ hoặc nếu không thể truy xuất bộ đệm đầu vào.
Một ngoại lệ NullPointerException sẽ được đưa ra nếu bộ đệm inputFileBuffer là null hoặc trống.
Tóm tắt
Đăng ký một tệp đầu vào hoặc bytes cho session đã cho.
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'.
"""
Giá trị trả về
Một đối tượng có các thuộc tính khác nhau tùy thuộc vào kiểu của input_file.
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): Một thực thể GwReturnObj với các thuộc tính 'session', 'input_file', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): Một thực thể GwReturnObj với các thuộc tính 'session', 'buffer', 'buffer_length', 'status'.
Thuộc tính status là một giá trị enum GW2_RetStatus kiểu số nguyên. Các số âm cho biết thất bại.
Tóm tắt
Hàm này đăng ký một tệp được lưu trong bộ nhớ làm tệp đầu vào cho một phiên được chỉ định
/**
* @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)
Giá trị trả về
Trả về một giá trị enum GW2_RetStatus dạng số nguyên. Các số âm cho biết thất bại.