File.ReadAllBytes(String) 메서드
정의
이진 파일을 열고 파일의 내용을 바이트 배열로 읽어 들인 다음 파일을 닫습니다.Opens a binary file, reads the contents of the file into a byte array, and then closes the file.
public:
static cli::array <System::Byte> ^ ReadAllBytes(System::String ^ path);
public static byte[] ReadAllBytes (string path);
static member ReadAllBytes : string -> byte[]
Public Shared Function ReadAllBytes (path As String) As Byte()
매개 변수
- path
- String
읽기 위해 열 파일입니다.The file to open for reading.
반환
- Byte[]
파일의 내용을 포함하는 바이트 배열입니다.A byte array containing the contents of the file.
예외
path
가 빈 문자열이거나 공백만 포함하거나 InvalidPathChars로 정의된 하나 이상의 잘못된 문자를 포함합니다.path
is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
path
이(가) null
인 경우path
is null
.
지정된 경로, 파일 이름 또는 둘 다가 시스템에서 정의한 최대 길이를 초과합니다.The specified path, file name, or both exceed the system-defined maximum length.
지정된 경로가 잘못되었습니다(예: 매핑되지 않은 드라이브에 있음).The specified path is invalid (for example, it is on an unmapped drive).
파일을 여는 동안 I/O 오류가 발생했습니다.An I/O error occurred while opening the file.
현재 플랫폼이 해당 작업을 지원하지 않는 경우This operation is not supported on the current platform.
또는-or-
path
에 디렉터리가 지정되었습니다.path
specified a directory.
또는-or- 호출자에게 필요한 권한이 없는 경우The caller does not have the required permission.
path
에 지정된 파일을 찾을 수 없습니다.The file specified in path
was not found.
path
의 형식이 잘못되었습니다.path
is in an invalid format.
호출자에게 필요한 권한이 없는 경우The caller does not have the required permission.
설명
파일 경로가 지정 된 경우이 메서드는 파일을 열고 파일의 내용을 바이트 배열로 읽어 들인 다음 파일을 닫습니다.Given a file path, this method opens the file, reads the contents of the file into a byte array, and then closes the file.