본문 바로가기
Full-Stack/JAVA

FileInputStream, File, messageSource.getMessage

by IT것저것 2024. 12. 4.

 

FileInputStream fis = null;
File file = null;

- FileInputStream : 파일 데이터를 바이트 단위로 읽어들이기 위한 클래스

ex) 텍스트 파일, 이미지 파일, 바이너리 데이터 등

 

File :  파일이나 디렉토리를 나타내는 클래스 

 


null로 초기화
  == 파일 입력 스트림과 파일 객체를 아직 생성되지 않았음을 나타낸다 

➡️ 이 방식은 try - catch - finally 구조에서 자원을 명확히 정리(close)하기 위해 사용된다

 

 

-- messageSource.getMessage 는 

import org.springframework.context.MessageSource;​
 

를 import 했는데 spring framework에서 국제화(i18n)와 메시지 관리를 위한 인터페이스인 MessageSource를 사용하기 위한 import이다 

 

MessageSource :  Spring에서 메시지를 외부화하고, 다국어 지원을 포함하여 동적 메시지 처리를 가능하게 하는 핵심 인터페이스