GW2DetermineFileTypeFromMemory
GW2DetermineFileTypeFromMemory 関数は、メモリ内に保持されたバッファに内容が格納されているファイルのファイルタイプを判定します。
- C++
- C#
- Java
- Python
- JavaScript
概要
#include "glasswall.core2.api.h"
ft_t GW2DetermineFileTypeFromFile(const char *inputFileBuffer, size_t inputLength);
戻り値
GW2DetermineFileTypeFromMemory がファイルタイプを識別できない場合、列挙型 ft_t の列挙定数 ft_unknown の値を返します。それ以外の場合は、ファイルタイプを示す列挙型 ft_t の値を返します。列挙定数の一覧は、C ソースのヘッダーファイル filetype.h にあります。
概要
/// <summary>
/// Returns a value indicating the the file type from an input file by Glasswall.
/// </summary>
/// <param name="inputFileBuffer">The input buffer containing the file to be determined</param>
/// <returns>A value indicating the determined file type</returns>s
public int DetermineFileTypeFromMemory(byte[] inputFileBuffer)
戻り値
判定されたファイルタイプを示す値 - 列挙定数の一覧は C ソースのヘッダーファイル filetype.h にあり、この関数の戻り値と一致しています。
概要
import com.glasswall.core2javabridge.*;
public int GW2DetermineFileTypeFromMemory(byte[] fileBuffer) throws GlasswallException, NullPointerException
public int GW2DetermineFileTypeFromMemory(byte[] fileBuffer, int length) throws GlasswallException, NullPointerException
注
The length of the fileBuffer may optionally be specified.
戻り値
GW2DetermineFileTypeFromMemory 関数は、ft_t 型の列挙子を int に変換して返します。列挙定数の一覧は、C ソースのヘッダーファイル filetype.h にあります。
NullPointerException 例外は、fileBuffer が null または空の場合にスローされます。
GlasswallException 例外は、fileBuffer を取得できない場合にスローされます。
概要
指定された入力ファイルのファイルタイプを、整数識別子または文字列として判定します。
def determine_file_type(self, input_file: Union[str, bytes, bytearray, io.BytesIO], as_string: bool = False, raise_unsupported: bool = True) -> Union[int, str]:
""" Determine the file type of a given input file, either as an integer identifier or a string.
Args:
input_file (Union[str, bytes, bytearray, io.BytesIO]): The input file to analyse. It can be provided as a file path (str), bytes, bytearray, or a BytesIO object.
as_string (bool, optional): Return file type as string, eg: "bmp" instead of: 29. Defaults to False.
raise_unsupported (bool, optional): Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
file_type (Union[int, str]): The file type.
"""
戻り値
判定されたファイルタイプを示す値または拡張子文字列です。この関数の戻り値と一致する列挙定数の一覧は、C ソースのヘッダーファイル filetype.h にあります。
概要
/**
* This function determines the file type for a given file provided it is supported by Glasswall. Notice this is not related to a session.
* @param {string} path The path to the provided file.
* @returns {number} The determined file type, as enumerated in the C source header file filetype.h.
*/
GW2DetermineFileTypeFromMemory(inputFileBuffer, inputLength)
戻り値
判定されたファイルタイプを示す値です。この関数で返される値と整合する列挙定数の一覧は、Cソースのヘッダーファイル filetype.h にあります。