GW2RegisterOutFile
ฟังก์ชัน GW2RegisterOutFile ใช้ลงทะเบียนปลายทางสำหรับไฟล์ที่จัดการแล้วซึ่งสร้างโดย Glasswall การใช้ฟังก์ชันนี้จะเปิดใช้งาน Manage & Protect Process Mode สำหรับเซสชัน
- C++
- C#
- Java
- Python
- JavaScript
สรุป
สำหรับเซสชัน session ฟังก์ชัน GW2RegisterOutFile จะลงทะเบียนไฟล์ที่มีชื่อเป็นสตริงซึ่งถูกชี้โดย outputFileBuffer ให้เป็นไฟล์ปลายทางสำหรับไฟล์ที่จัดการแล้วซึ่งสร้างโดย Glasswall base name ของพาธต้องแตกต่างจาก base name ที่ลงทะเบียนโดยใช้ฟังก์ชัน GW2RegisterInputFile การใช้ฟังก์ชันนี้จะเปิดใช้งาน Manage & Protect Process Mode สำหรับเซสชัน
#include "glasswall.core2.api.h"
int GW2RegisterOutFile(Session session, const char *outputFilePath);
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
ตัวอย่าง
#include "glasswall.core2.api.h"
HANDLE session = GW2OpenSession();
if (!session)
/* deal with error */
else
{
if (GW2RegisterOutFile(session, "managed_file.docx") < 0)
/* deal with error */
else
/* continue processing */
...
}
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
สรุป
public int RegisterOutFile(
int session,
string outputFilePath)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว
สรุป
import com.glasswall.core2javabridge.*;
public int GW2RegisterOutFile(int session, String outputFilePath) throws GlasswallException, NullPointerException
(Deprecated)
public int GW2RegisterOutFile(int session, byte[] outputFilePath) throws GlasswallException, NullPointerException
หมายเหตุ
พารามิเตอร์ของฟังก์ชัน GW2RegisterOutFile ได้รับการอัปเดตให้ใช้ String แทน byte[] ฟังก์ชันเดิมถูกเลิกใช้งานแล้ว
ส่งกลับ
ฟังก์ชัน GW2RegisterOutFile จะส่งกลับค่า enumeration GW2_RetStatus ที่แปลงเป็น int ค่าเป็นลบหมายความว่าเกิดข้อผิดพลาด 0 หมายถึงสำเร็จ โปรดดูรายละเอียดใน API Overview/Return types
จะมีการโยนข้อยกเว้น NullPointerException หาก outputFilePath เป็น null หรือว่างเปล่า
จะมีการโยนข้อยกเว้น GlasswallException หาก session ไม่ถูกต้อง หากไม่สามารถดึง outputFilePath ได้ หรือหากไม่สามารถแปลง outputFilePath เป็น UTF-8 ได้
สรุป
ลงทะเบียนไฟล์เอาต์พุตสำหรับเซสชันที่กำหนด หาก output_file เป็น None ไฟล์จะถูกส่งกลับเป็นแอตทริบิวต์ 'buffer' และ 'buffer_length'
def register_output(self, session, output_file: Optional[str] = None):
""" Register an output file for the given session. If output_file is None the file will be returned as 'buffer' and 'buffer_length' attributes.
Args:
session (int): The session integer.
output_file (Optional[str]): If specified, during run session the file will be written to output_file, otherwise the file will be written to the glasswall.GwReturnObj 'buffer' and 'buffer_length' attributes.
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.
"""
ส่งกลับ
gw_return_object (glasswall.GwReturnObj): อินสแตนซ์ GwReturnObj ที่มีแอตทริบิวต์ 'status' ระบุผลลัพธ์ของการเรียกใช้ฟังก์ชัน หาก output_file เป็น None (โหมดหน่วยความจำ) จะมี 'buffer' และ 'buffer_length' รวมอยู่ด้วย ซึ่งประกอบด้วยเนื้อหาไฟล์และขนาดไฟล์
แอตทริบิวต์ status เป็นค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงความล้มเหลว
สรุป
ฟังก์ชันนี้ลงทะเบียนไฟล์ปลายทางสำหรับไฟล์ที่ถูกจัดการซึ่งสร้างโดย Glasswall.
/**
* @param {number} session The ID of the session.
* @param {string} outputFilePath The specified output path. Must be different to the specified input file path.
*/
GW2RegisterOutFile(
session,
outputFilePath)
ส่งกลับ
ส่งกลับค่า enum GW2_RetStatus แบบจำนวนเต็ม ตัวเลขติดลบหมายถึงล้มเหลว