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에 있으며, 이 함수의 반환 값과 일치합니다.