파일읽어서 String 얻기(File,InputStreamReader,BufferedReader)

Posted on 2020. 11. 25. 18:02
Filed Under Programming/Java


//파일읽어서 String 얻기
public String getZoneFileToString(String filePath)
{
	if (filePath == null || "".equals(filePath)) {
		System.out.println("파일경로 입력바람 오바!!");
//		throw new AssertionError();
		return null;
	}

	StringBuffer strBuffer = new StringBuffer();
	InputStreamReader inputStReader = null;
	BufferedReader reader = null;
	String line = null;
		
	File file = new File(filePath);
	if(!file.exists()){
		System.out.println("해당 파일경로의 파일이 없음!!");
		return null;
	}
	try {
		
		inputStReader = new InputStreamReader(new FileInputStream(file), "euc-kr");
		reader = new BufferedReader(inputStReader);
		
		while (true) {
			line = reader.readLine();
			if (line == null) {
				break;
			}
			strBuffer.append(line);
			strBuffer.append("\n");
		}
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (reader != null) reader.close();
			if (inputStReader != null) inputStReader.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	return strBuffer.toString();
}

반응형

[Eclipse] 잦은 Permgen space 에러 때문에 괴로울때 조치

Posted on 2020. 11. 19. 10:49
Filed Under Web Programming/개발환경

잦은 PermGen space 에러...

보통은 Tomcat Server 재시작하여 처리하였는데..



이클립스 메뉴: Windows > Preferences - Java > Installed JREs


오른쪽 Installed JREs중 사용중인 녀석을 선택하고 [Edit]버튼 클릭 ▼


//Default VM arguments에 메모리 설정 입력:
-vmargs-Xms40m -Xmx256m -XX:MaxPermSize=512m


■정보출처: https://flatsun.tistory.com/569



2020.11.19 ADD,

추가후 아래 오류가 가끔 발생하는듯하다. 

좀더 모니터링후 처리예정.


반응형

[Eclipse] 실행시 html 한글 깨짐현상

Posted on 2020. 11. 10. 14:28
Filed Under Web Programming/개발환경


▼ 현상

select list에서 한글이 깨져보임. 



▼ 추적

- 서버단은 문제 없어보임 

- *.js 파일도 utf-8로 인코딩 되어 있음 ☞ [전체]


▼ 처리

eclipse - Windows - Preferences : General > workspace - Text file encoding 이 MS949 기본값으로 되어 있었음.

utf-8로 변경 후 tomcat 재시작!

그래도 그대로일 경우 웹페이지 리로드 (Ctrl+새로고침)이 필요할 수도 있음.




▼ 추가정보

메뉴: Window - Preferences - General > Content Types 에서 JSP,HTML 파일 종류별 기본 인코딩 설정가능!


General > Workspace > Text file encoding을 UTF-8으로 바꿉니다.

General > Content Type 

├ Java Class File : Default encoding에 UTF-8 입력후 Update 클릭

├ Text > JSP : 위와 동일

└ Web > CSS Files, HTML Files, JSP Files 모두 : UTF-8



반응형

[VS] 빌드후 이벤트 스크립트 샘플

Posted on 2020. 9. 14. 10:22
Filed Under C#


//빌드후에 DLL 자동 복사하기
copy /Y $(SolutionDir)..\_ExeCommon\_$(ConfigurationName)\ServerCommonClass.dll $(TargetDir)
copy /Y $(SolutionDir)..\_ExeCommon\_$(ConfigurationName)\CommonClass.dll $(TargetDir)


반응형

[MSSQL] DB프로시저내 임시테이블 생성코드

Posted on 2020. 7. 30. 10:17
Filed Under DB


▼ 샘플코드


--테이블변수
DECLARE @temp_REPORT_SCD_0415_PORTMATCH_HIERARCHY_COLLECT_SAVE Table
            (CenterCode CHAR(6), 
	     ModelID int, 
	     TotalCount int,
	     EffectedRows int,
	     StartTime DateTime,
	     EndTime DateTime
);

--임시테이블 (주로사용)
CREATE TABLE dbo.#TmpTable (
           [UID] IDENTITY(1,1),
           ItemName VARCHAR(150),
           InsertDate DateTime,
           UpdateDate DateTime
);

▼ 상세설명

[MSSQL] 임시 테이블 vs 테이블 변수 2016.01





반응형

About

by 쑤기c

반응형