GW2RegisterInputFile
ฟังก์ชัน GW2RegisterInputFile ลงทะเบียนพาธไปยังไฟล์ที่จะประมวลผลใน session
- C++
- C#
- Java
- Python
- JavaScript
สรุป
ฟังก์ชัน GW2RegisterInputFile ลงทะเบียนไฟล์ที่จะประมวลผลใน session session ชื่อไฟล์คือสตริงที่ inputFilePath ชี้อยู่
#include "glasswall.core2.api.h"
int GW2RegisterInputFile(Session session, const char *inputFilePath);
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
ตัวอย่าง
#include "glasswall.core2.api.h"
HANDLE session = GW2OpenSession();
if (!session)
/* deal with error */
else
{
if (GW2RegisterInputFile(session, "filename.doc") < 0)
/* deal with error */
else
/* continue processing */
...
}
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
สรุป
public int RegisterInputFile(
int session,
string inputFilePath)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
import com.glasswall.core2javabridge.*;
public int GW2RegisterInputFile(int session, String inputFilePath) throws GlasswallException, NullPointerException
(Deprecated)
public int GW2RegisterInputFile(int session, byte[] inputFilePath) throws GlasswallException, NullPointerException
หมายเหตุ
พารามิเตอร์ของฟังก์ชัน GW2RegisterInputFile ได้รับการอัปเดตให้ใช้ String แทน byte[] แล้ว ฟังก์ชันเดิมถูกเลิกใช้งานแล้ว
ส่งกลับ
ฟังก์ชัน GW2RegisterInputFile จะส่งกลับค่า enumeration GW2_RetStatus ที่แปลงเป็น int ค่าจะเป็นค่าติดลบหากเกิดข้อผิดพลาด 0 หมายถึงสำเร็จ โปรดดูรายละเอียดใน API Overview/Return types
ระบบจะโยนข้อยกเว้น NullPointerException หาก inputFilePath เป็น null หรือว่างเปล่า
ระบบจะโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง หากไม่สามารถดึง inputFilePath ได้ หรือหากไม่สามารถแปลง inputFilePath เป็น UTF-8 ได้
สรุป
ลงทะเบียนไฟล์อินพุตหรือไบต์สำหรับ 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'.
"""
ส่งกลับ
อ็อบเจ็กต์ที่มีแอตทริบิวต์แตกต่างกันไปตามชนิดของ input_file
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): อินสแตนซ์ของ GwReturnObj ที่มีแอตทริบิวต์ 'session', 'input_file', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): อินสแตนซ์ GwReturnObj ที่มีแอตทริบิวต์ 'session', 'buffer', 'buffer_length', 'status'
แอตทริบิวต์ status เป็นค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงความล้มเหลว
สรุป
ฟังก์ชันนี้ลงทะเบียนไฟล์ที่ระบุเป็นไฟล์อินพุตสำหรับ session ที่ระบุ
/**
*
* @param {number} session The ID of the session.
* @param {string} inputFilePath The path of the file to be registered
*/
GW2RegisterInputFile(session, inputFilePath)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว