일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 무선랜카드
- XMLHTTP
- 커널
- include
- SQL Injection
- disabled
- 시놀로지
- PHP GCM
- submit
- AC1300
- ajax
- RTL88x2BU
- readonly
- DS718+
- jquery 레이어
- Getrows
- 따라다니는 배너
- replace
- utf-8
- jQuery
- Injection
- 크로스 컴파일
- synology
- FileSystemObject
- form
- javascript
- euc-kr
- println
- ASP
- lsusb
- Today
- Total
목록Java Programing (10)
아는 것이 좋은 것이다.
HttpServletResponse response; response.setContentType("text/html;charset=UTF-8"); // html 타입으로 변환하여 html 태그 사용이 가능해짐PrintWriter out = response.getWriter(); out.println("asdassd"); // return 값이 없는 경우 웹페이지에 해당값을 보낼수 있다.
public void writeFile(MultipartHttpServletRequest file, HttpServletRequest request) throws IOException {File path = new File(request.getRealPath("/resources/upload/"));String fileName = file.getFile("filename").getOriginalFilename();File destination = File.createTempFile("file", fileName, path); FileCopyUtils.copy(file.getFile("filename").getInputStream(), new FileOutputStream(destination));Syst..
// 연결URL url = new URL("값을 보낼 URL");HttpURLConnection conn = (HttpURLConnection) url.openConnection();conn.setDoOutput(true);conn.setRequestMethod("POST"); // 보내는 타입conn.setRequestProperty("Accept-Language", "ko-kr,ko;q=0.8,en-us;q=0.5,en;q=0.3");// 데이터String param = "{\"title\": \"asdasd\", \"body\" : \"ddddddddd\"}"; // 전송OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream());..
String[] n = new String[]{"google","microsoft","apple"}; final List list = new ArrayList(); Collections.addAll(list, n); list.remove("apple"); 출처 : http://stackoverflow.com/questions/7940337/remove-a-specific-string-from-an-array-of-string
public static void imgFile(String localPath, String path, String name){ String file_ext=name.substring( name.lastIndexOf('.')+1, name.length()); BufferedImage image = null; try{ image = ImageIO.read(new URL(path+name)); BufferedImage bufferedImage = new BufferedImage(image.getWidth(),image.getHeight(), BufferedImage.TYPE_INT_BGR); Graphics2D graphics = (Graphics2D) bufferedImage.getGraphics(); g..
import java.io.*; public class LogSave { public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub File file = new File("save.log"); PrintStream printStream = new PrintStream(new FileOutputStream(file)); System.out.println("1"); // 화면으로 1 이라는 문자가 표시된다. System.setOut(printStream); System.out.println("2"); // save.log 파일로 2 라는 문자가 표시된다. } } 자바 로그 저장 소스
String txt1 = "가나다라마"; String txt2 = "ABCDEF"; System.out.println(txt1.length()); // 출력 결과: 5 System.out.println(txt2.length()); // 출력 결과: 6
숫자를 문자열로 바꾸기 int i = 1234; String s = String.valueOf(i); 문자열 "1234"로 변환 String s = Integer.toString(i); 문자열 "1234"로 변환 String s = ””+i; 문자열 "1234"로 변환 String s = “”+12.34; 문자열 "12.34"로 변환 String s = “”+0; 문자열 "0"로 변환 문자열을 숫자로 바꾸기 String str = "1234"; int i = Integer.valueOf(str).intValue(); int i = Integer.parseInt(str); long i = Long.parseLong(str) double i = Double.valueOf(str).doubleValue(); ..
import java.io.*; public class SaveLog { public static void main(String[] args) throws FileNotFoundException { // TODO Auto-generated method stub File file = new File("Save.txt"); PrintStream printStream = new PrintStream(new FileOutputStream(file)); System.out.println("출력한다."); System.setOut(printStream); System.out.println("저장하고 출력하지 않는다."); } }
import java.io.*; //입출력 public class Image_Move { public static void main(String[] args) { // TODO Auto-generated method stub //폴더 참조 File original_dir = new File("D:\\aaaaa\\bbbbb"); //절대경로 File move_dir = new File("D:\\aaaaa\\ccccc"); if(original_dir.exists()) { //폴더의 내용물 확인 -> 폴더 & 파일.. File[] fileNames = original_dir.listFiles(); //내용 목록 반환 //System.out.println("--------------폴더 읽기----------..