본문 바로가기

IT/JAVA17

[JAVA] TIB/RV 랑데부 통신 관련 로컬 통신 테스트. // Listener open -> sender open -> send -> sender close -> Listener close public class main implements TibrvMsgCallback { public String service = "9999"; public String network = "127.0.0.1"; public String daemon = "tcp:7500"; public String subject = "TEST"; public TibrvMsg msg = new TibrvMsg(); public TibrvQueue queue; public TibrvRvdTransport transport; // tip: arguments are passed via the fiel.. 2021. 12. 23.
[JAVA] 가끔 써먹을 base64 인코딩 전용 메서드 생성. Java에서 File 이미지 데이터를 Base64 인코딩을 위한 아주 간단한 메서드를 기록(?) 공유 하고자 한다. fileToString(file 데이터만 넘겨주면 끝. public String fileToString(File file) { String fileString = new String(); FileInputStream inputStream = null; ByteArrayOutputStream byteOutStream = null; try { inputStream = new FileInputStream(file); int len = 0; byte[] buf = new byte[1024]; while ((len = inputSteam.read(buf)) != -1) { byteOutSteam.w.. 2021. 12. 22.
[JAVA] 실 이미지에서 특정 좌표에 네모박스 그리기 https://code-zzolbo.tistory.com/55 [JAVA] 이미지파일 사이즈 변경 및 확인. 상황 예시) 모바일 카메라로 사진을 촬영 한다. 각 디바이스 마다 width , height 가 다르게 찍히게 될테니 , 이를 크기 고정시키고 웹에 다시 업로드 시키고자 한다. 이럴때 필요한 리사이징 & 변경 code-zzolbo.tistory.com 에서 이미지 파일 사이즈를 변경하고 이미지에서 네모박스로 특별한 표시를 원한다면, x축 , y축 , width , height 값을 변수로 받아 처리 할 수 있다. [ 활용 메서드 생성 ] public void paint(String x , String y , String w , String h , String fileFullpath) { Image.. 2021. 12. 22.
[JAVA] 이미지파일 사이즈 변경 및 확인. 상황 예시) 모바일 카메라로 사진을 촬영 한다. 각 디바이스 마다 width , height 가 다르게 찍히게 될테니 , 이를 크기 고정시키고 웹에 다시 업로드 시키고자 한다. 이럴때 필요한 리사이징 & 변경된 크기 확인을 하기 위한 용도이다. try { // ex) 모바일 세로 고정 크기 235 * 510 // ex) 모바일 가로 고정 크기 510 * 235 // 원본 image = ImageIO.read(new File("이미지 풀 경로")); // 원본 width , height int ori_width = image.getWidth(null); int ori_height = image.getHeight(null); int r_w = 235; // 리사이징 될 width int r_h = 510; .. 2021. 12. 21.