일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- AJAX
- JavaScript
- maven
- IntelliJ
- MSSQL
- 문서
- Spring Boot
- JDBC
- Docker
- error
- Open Source
- Eclipse
- myBatis
- Source
- jpa
- Core Java
- Tomcat
- Python
- PostgreSQL
- MySQL
- spring
- STS
- Thymeleaf
- 오픈소스
- oracle
- Exception
- SpringBoot
- 설정
- ubuntu
- git
- Today
- Total
목록Core Java (61)
헤르메스 LIFE
일반적으로 List 표현을 많이 사용하게 되는데.. List 안에 Map이 있는 경우, 데이터를 찾기가 쉽지 않습니다. 결국은 for loop 를 이용하는 수 밖에.. package test.sample.string; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; public class RamdaSample { public static void main( String[] args ) { List list = new ArrayList(); Map map = null; map = ne..
출처 javavoa-mok.tistory.com/58 대용량 엑셀 업로드 소스를 찾던 중 아래의 소스가 가장 좋았습니다. 다만 읽기용으로만 사용해야 합니다. 소스자체가 읽는 예제 밖에 없지만.. 읽는 속도만 빠릅니다. Excel 타입이라든지, 폰트 등의 속성은 무시합니다. ( 전부 String 문자열로 읽히는 듯 합니다. ) import java.io.File; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.apache.poi.ooxml.util.SAXHelper; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.s..
public class DateSample { static Logger logger = LoggerFactory.getLogger( DateSample.class ); public static void main( String[] args ) { try { long start = System.currentTimeMillis(); //시작하는 시점 계산 Thread.sleep( 10000 ); long end = System.currentTimeMillis(); //프로그램이 끝나는 시점 계산 logger.info( "실행 시간 : " + ( end - start ) / 1000.0 + "초" ); //실행 시간 계산 및 출력 } catch ( InterruptedException ie ) { logger...
substring의 사용은 항상 헛갈립니다. 그래서, 적어두고 찾아봅니다. import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class StringSample { static Logger logger = LoggerFactory.getLogger( StringSample.class ); public static void main( String[] args ) { String input1 = "abcd"; String input2 = "ABCD"; String output = ""; // 마지막 문자삭제 if ( input1.length() > 0 ) { output = input1.substring( 0, input1.length() - 1..
출처 : http://shonm.tistory.com/377 JDOM 이라는 API 를 통해 간단히 XML 을 만들 수 있다. 아래 코드를 보면 바로 이해가 될 것으로 보인다. (String 으로 출력 하는 방식과 file 로 만드는 방식을 모두 정리 하였다.) import java.io.FileOutputStream; import java.io.IOException; import org.jdom.Document; import org.jdom.Element; import org.jdom.output.Format; import org.jdom.output.XMLOutputter; public class XmlGene { /** * @param args */ public static void main(Str..
출처 : http://makerj.tistory.com/149 1. XML Document 생성 1.1 XML 불러오기 Case1> File로부터 읽는 경우 Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(filePath)); Case2> String으로부터 읽는 경우 Document xml = DocumentBuilderFactory.newInstance().newDocumentBuilder(). parse(new ByteArrayInputStream(xmlString.getBytes())); 1.2 정규화 xml.getDocumentElement().normalize(); 2. XPath 생성..
출처 : http://www.tutorialspoint.com/java_xml/java_jdom_create_document.htm package com.file .utils; import java. io.IOException ; import org. jdom.Attribute ; import org. jdom.Document ; import org. jdom.Element ; import org. jdom.output .Format; import org. jdom.output .XMLOutputter; public class CreateXmlFileDemo { public static void main( String[] args ) { try { // root element Element carsEle..
출처 : http://www.tutorialspoint.com/java_xml/java_dom4j_modify_document.htm package com.file .utils; import java. io.File ; import java. io.IOException ; import java. io.UnsupportedEncodingException ; import java. util.Iterator ; import java. util.List ; import org. dom4j.Document ; import org. dom4j.DocumentException ; import org. dom4j.Element ; import org. dom4j.Node ; import org. dom4j.io .Ou..
출처 : http://www.tutorialspoint.com/java_xml/java_jdom_parse_document.htm dinkar kad dinkar 85 Vaneet Gupta vinni 95 jasvir singh jazz 90 package com.file .utils; import java. io.File ; import java. io.IOException ; import javax. xml.parsers .DocumentBuilder; import javax. xml.parsers .DocumentBuilderFactory; import javax. xml.parsers .ParserConfigurationException; import javax. xml.xpath .XPath;..
public String executeJSP(String urlstr) { URL url = null; BufferedReader in = null; URLConnection con = null; String returnMsg = ""; try { url = new URL(urlstr); con = url.openConnection(); con.connect(); System.out.println("++++++++Start+++++++++++"); System.out.println("getContentType() : " + con.getContentType() ); System.out.println("getContentLength() : " + con.getContentLength()); System.o..