GW2RegisterExportTextDumpMemory
GW2RegisterExportTextDumpMemory 関数は、エクスポートされたテキストダンプファイルを保存するメモリ位置を登録します。この関数を使用すると、セッションの Export Process Mode に対して Text Dump オプションが有効化されます。
- C++
- C#
- Java
- Python
- JavaScript
概要
セッション session に対して、GW2RegisterExportTextDumpMemory 関数は、エクスポートされたコンテンツのテキストダンプを配置する場所と、テキストダンプコンテンツのバイト単位のサイズを配置する場所を登録します。テキストダンプコンテンツへのポインタは exportTextDumpFileBuffer が指すオブジェクトに格納され、テキストダンプデータのバイト単位のサイズは exportTextDumpLength が指す size_t オブジェクトに格納されます。テキストダンプコンテンツは、GW2CloseSession を使用してセッションが閉じられると削除されます。この関数を使用すると、セッションの Export Process Mode に対して Text Dump オプションが有効化されます。
#include "glasswall.core2.api.h"
int GW2RegisterExportTextDumpMemory(Session session,
char **exportTextDumpFileBuffer,
size_t *exportTextDumpLength);
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
概要
public int RegisterTextDumpMemory(
int session,
out IntPtr textDumptFileBufferPtr,
ref UIntPtr textDumpBufferLengthPtr)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
概要
import com.glasswall.core2javabridge.*;
public int GW2RegisterExportTextDumpMemory(int session) throws GlasswallException
説明
GW2RegisterExportTextDumpMemory 関数は、session で指定されたセッションのエクスポート済みテキストダンプの出力先としてメモリバッファを登録します。エクスポートされたテキストダンプデータを取得するには、GW2RunSession を呼び出した後に GetTextDumpBuffer を呼び出してください。
戻り値
GW2RegisterExportTextDumpMemory 関数は、GW2_RetStatus 列挙を int に変換して返します。エラーが発生した場合、値は負になります。0 は成功を示します。詳細については、API Overview/Return types を参照してください。
GlasswallException 例外は、session が無効な場合にスローされます。
概要 - データの取得
import com.glasswall.core2javabridge.*;
public byte[] GetTextDumpBuffer(int session) throws GlasswallException
説明
session で指定されたセッションに関連付けられた、エクスポート済みテキストダンプバッファの内容を取得します。
戻り値
エクスポートされたテキストダンプを含む byte[] を返します。GW2RegisterExportTextDumpMemory と GW2RunSession が呼び出されていない場合、このバイト配列は null になります。
`session``` が無効な場合、GlasswallException 例外がスローされます。
概要
指定されたセッションのエクスポート済みテキストダンプの出力先としてメモリバッファを登録します。テキストダンプは、セッションの run_session 呼び出し中に作成されます。
def _GW2RegisterExportTextDumpMemory(self, session: int):
""" Registers an export text dump to be written in memory.
Args:
session (int): The session integer.
Returns:
gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'status'.
"""
戻り値
gw_return_object (glasswall.GwReturnObj): 'session'、'buffer'、'buffer_length'、'status' の属性を持つ GwReturnObj インスタンス。
status 属性は整数の GW2_RetStatus enum 値です。負の数は失敗を示します。
テキストダンプは、run_session が呼び出された後に glasswall.utils.buffer_to_bytes を使用して bytes に変換できます。
例
import glasswall
editor = glasswall.Editor(r"<path to dir containing Glasswall libraries>")
input_file = r"<path to an input file>"
with open(input_file, "rb") as f:
input_file_memory = f.read()
with editor.new_session() as session:
register_input = editor._GW2RegisterInputMemory(session, input_file_memory)
register_export = editor._GW2RegisterExportMemory(session)
register_export_text_dump_memory = editor._GW2RegisterExportTextDumpMemory(session)
status = editor.run_session(session)
file_session_status = editor._GW2FileSessionStatus(session)
file_error_message = editor._GW2FileErrorMsg(session)
file_bytes = glasswall.utils.buffer_to_bytes(
register_export.buffer,
register_export.buffer_length
)
text_dump = glasswall.utils.buffer_to_bytes(
register_export_text_dump_memory.buffer,
register_export_text_dump_memory.buffer_length
)
概要
この関数は、指定されたセッションに対してエクスポートテキストダンプのメモリ位置を登録します。
/**
*
* @param {number} session The ID of the session.
* @param {string} exportTextDumpFileBuffer A pointer to the specified memory location.
* @param {number} exportTextDumpLength The size of the file buffer.
*/
GW2RegisterExportTextDumpMemory(session, exportTextDumpFileBuffer, exportTextDumpLength)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。