1. []으로 싸주면 문자자체로 인식하는 것들. 


*  ⇒ [*] 

+  ⇒ [+] 

$  ⇒ [$] 

|  ⇒ [|] 



2. \\를 붙여줘야 하는 것들. 


( ⇒ \\( 

) ⇒ \\) 

{ ⇒ \\{ 

} ⇒ \\} 

^ ⇒ \\^ 

[ ⇒ \\[ 

] ⇒ \\] 



3. 자바의 특수문자는 \을 쓴다. 


 " ⇒ \" 



4. 나머지 부호들은 괜찮은 듯 하다. 

확인된 것. 


! # % & @ ` : ; - . < > , ~ ' 




ex ) 위에 놈들 다 지워 보자. 


    String c = "!\"#$%&(){}@`*:+;-.<>,^~|'[]"; 

    c = c.replaceAll("!\"#[$]%&\\(\\)\\{\\}@`[*]:[+];-.<>,\\^~|'\\[\\]", ""); 





 public static String getSTRFilter(String str){ 

  int str_length = str.length(); 

  String strlistchar   = ""; 

  String str_imsi   = "";  

  String []filter_word = {"","\\.","\\?","\\/">\\~","\\!","\\@","\\#","\\$","\\%","\\^","\\&","\\*","\\(","\\)","\\_","\\+","\\=","\\|","\\\\","\\}","\\]","\\{","\\[","\\\"","\\'","\\:","\\;","\\<","\\,","\\>","\\.","\\?","\\/"}; 


  for(int i=0;i<filter_word.length;i++){ 

   //while(str.indexOf(filter_word[i]) >= 0){ 

      str_imsi = str.replaceAll(filter_word[i],""); 

      str = str_imsi; 

   //} 

  } 


  return str; 


 } 




import java.util.StringTokenizer; 


public class WebUtil 

           // 문자열 변환  String a= "abc" => replace(a, "c") => a : ab 

           public String strReplace(String s1, String s2){ 

                      String res = ""; 

                      StringTokenizer str = new StringTokenizer(s1, s2); 



                       while(str.hasMoreTokens()){ 

                                     res += str.nextToken();   

                               System.out.println(res); 

                       } 

               return res; 

           } 

}



출처 : http://lazli.tistory.com/47

-- Java DateFormat


ex1)

SimpleDateFormat df = new SimpleDateFormat("yyyy년 MM월 dd일 hh시 mm분 ss초");

//SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

//SimpleDateFormat df= new SimpleDateFormat("yyyy-MM-dd");


Date date = new Date();

String today = df.format(date);

System.out.println(today);


Calendar c = Calendar.getInstance();

String today2 = df.format(c.getTime());

System.out.println(today2);




ex2)

Date now = new Date();

DateFormat format1 = DateFormat.getDateInstance(DateFormat.FULL);
System.out.println(format1.format(now));
DateFormat format2 = DateFormat.getDateInstance(DateFormat.LONG);
System.out.println(format2.format(now));
DateFormat format3 = DateFormat.getDateInstance(DateFormat.MEDIUM);
System.out.println(format3.format(now));
DateFormat format4 = DateFormat.getDateInstance(DateFormat.SHORT);
System.out.println(format4.format(now));



2009년 5월 29일 금요일
2009년 5월 29일 (금)
2009. 5. 29
09. 5. 29






-- 날째 객체 현재 날짜 비교


Date memDelStartDate; // 삭제 시작일

Date currentDate; // 현재날짜 Date

String oTime = ""; // 현재날짜

String compareVal = "N";



SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat ( "yyyy-MM-dd", Locale.KOREA );

Date currentTime = new Date();

oTime = mSimpleDateFormat.format ( currentTime ); //현재시간 (String)


memDelStartDate = mSimpleDateFormat.parse( "2015-07-31" );

currentDate =  mSimpleDateFormat.parse( oTime );

int compare = currentDate.compareTo( memDelStartDate ); // 날짜비교


if ( compare > 0 ){ // 현재날짜가 삭제 시작일 후 인 경우

//System.out.println("currentDate  >  memDelStartDate");

compareVal = "N";

} else if ( compare < 0) { // 현재날짜가 삭제 시작일 전 인 경우

compareVal = "Y";

//System.out.println("currentDate  <  memDelStartDate");

} else { // 현재날짜가 삭제 시작일 인 경우

compareVal = "Y";

//System.out.println("currentDate  =  memDelStartDate");

}

'Server Enterprise > Java' 카테고리의 다른 글

URL Encoding 특수문자 코드  (0) 2015.07.22
[Encode] java replaceall 특수문자  (0) 2015.07.22
[String Replace] email 개인정보 asterisk 치환  (0) 2015.06.13
[decompile] java decompiler  (0) 2014.12.30
[Encode] 한글 인코딩  (0) 2014.08.15

// 테스트 이메일 array

String email[] = { "denodo1@gmail.com", 

"forever3031@gmail.com", 

"titleaaaa3@gmail.com", 

"ssangssyo@gmail.com" };


// split("@") 하기위한 변수

String[] switchEmail = null;


// 결과값 담는 변수

String resultEmail="";



for(int i=0; i<email.length; i++) {

switchEmail = email[i].split("@");

// 정보보호 결과값 담는 변수

String contentEmail="";


for(int j=0; j<switchEmail[0].length(); j++) {

if(j == 2 || j==3 || j==4 ) {

contentEmail += "*";

}else {

contentEmail += switchEmail[0].charAt(j);

}

}


resultEmail = contentEmail + "@" + switchEmail[1];

System.out.println("전환후 이메일                ::           "+i+"    " + resultEmail);

}

'Server Enterprise > Java' 카테고리의 다른 글

[Encode] java replaceall 특수문자  (0) 2015.07.22
[Date] 날짜 객체 현재 날짜 비교 / DateFormat  (0) 2015.07.08
[decompile] java decompiler  (0) 2014.12.30
[Encode] 한글 인코딩  (0) 2014.08.15
[Image Object] width, height  (0) 2014.03.11

google - java decompiler 검색 - 


http://jd.benow.ca/ 

사이트의


JD - GUI download release 이용


jd-gui-0.3.6.windows.zip



war 압축을 푼뒤 디컴파일러로 

Save All Sources 하면 자바로 디컴파일 된 파일이 폴더별로 만들어짐


유용잼

String keyword = request.getParameter("keyword");

if(keyword != null){

keyword = new String(keyword.getBytes("8859_1"),"utf-8");

}else{

keyword= "";

}

BufferedImage bimg = ImageIO.read(new File(filename));

int width          = bimg.getWidth();

int height         = bimg.getHeight();

'Server Enterprise > Java' 카테고리의 다른 글

[decompile] java decompiler  (0) 2014.12.30
[Encode] 한글 인코딩  (0) 2014.08.15
[Java] System.getProperty() 에 관하여  (0) 2013.06.14
Java 멤버와 변수에 대한 고찰  (0) 2013.01.08
POJO 개념  (0) 2013.01.05
System.getProperty() 용법, 시스템 프로퍼티

시스템 프로퍼티란 시스템 환경에 관한 정보를 말한다.
System 클래스에 있는 getProperty() 메소드를 이용하면, 현재 사용하고 있는 환경 정보를 얻을 수 있다.

import java.util.*;
.
.
String version = System.getProperty("java.version");


주요 프로퍼티는 아래와 같다.

java.version : Java의 버전 : 1.4.2_13

Java.vendor : Java의 벤더 (공급자) : Sun Microsystems Inc.

java.vendor.url : Java의 벤더의 URL : http://java.sun.com

java.home : Java를 인스톨한 디렉토리 : c:\j2sdk1.6.2_13

java.class.version : Java 클래스의 버전 : 48

java.class.path : Java 클래스가 존재하는 경로 : c"\Java

java.ext.dir : 확장기능 클래스를 포함하는 디렉토리 : null (미설정의 경우)

os.name : OS의 이름 : Window 7

os.arch : OS의 아키텍처 : x86

os.version : OS 의 버전 : 6.1

file.separator : 파일을 구분하는 문자 : \(Unix 에서는 /)

path.separator : 경로를 구분하는 문자 : (Unix 에서는 :)

line.separator : 행을 구분하는 문자(개행코드) : \n

user.name : 사용자 계정 : j

user.home : 사용자 홈 디렉토리 : c:\Document and Settings\j

user.dir : 현재 작업 디렉토리 : c:\Java





'Server Enterprise > Java' 카테고리의 다른 글

[decompile] java decompiler  (0) 2014.12.30
[Encode] 한글 인코딩  (0) 2014.08.15
[Image Object] width, height  (0) 2014.03.11
Java 멤버와 변수에 대한 고찰  (0) 2013.01.08
POJO 개념  (0) 2013.01.05

Java 멤버

자바의 클래스 안에는 변수와 메소드가 올 수 있는데, 이들 클래스와 메소드를 멤버라 부른다

멤버변수 (Member Variable)는 클래스 안에서 선언된 변수를 말하는데, 초기화를 시켜주지 않아도 객체를 생성 할 때 각 자료형의 기본 값으로 초기화 된다.


기본적으로 변수(Variable)란 데이터를 저장하는 공간이자 물리적인 메모리 공간을 가리키는 주소이다.

변수(Variable)는 그리하여 위에서 언급했던 멤버안의 멤버변수와 지역 변수 이다.


멤버 변수는 3가지로 나뉘는데 클래스 변수와 인스턴스 변수로 나뉘어진다.

클래스변수 - 선언시 static 키워드가 선언된 메소드로 자바 어플리케이션 종료 시 까지 남아있으며 클래스의 모든 인스턴스들이 사용 할 수 있는 변수

종단변수 - 선언시 final 키워드가 선언되며, 더이상의 변수가 아닌 상수 개념으로서의 값이 변하지 않는 변수

인스턴스변수 - 클래스의 멤버로 선언되나 static 키워드는 선언되지 않은 메소드로 인스턴스가 참조될 때만 사용 가능하게 되는 변수


지역변수 - 메소드 안에서 선언되며 메소드 시작시 생성, 메소드 종료시 삭제되는 등 메소드의 라이프사이클과 함께 한다.

그리고 지역변수는 그 메소드 내에서만 사용이 유효하다.



'Server Enterprise > Java' 카테고리의 다른 글

[decompile] java decompiler  (0) 2014.12.30
[Encode] 한글 인코딩  (0) 2014.08.15
[Image Object] width, height  (0) 2014.03.11
[Java] System.getProperty() 에 관하여  (0) 2013.06.14
POJO 개념  (0) 2013.01.05

POJO (Plain Old Java Object)


POJO는 기본적으로 Sun의 Java Beans나 EJB(Enterprise JavaBeans)의 Beans를 뜻하는 것이 아닌 순수하게 setter, getter 메소드로 이루어진 Value Object성의 Bean을 뜻한다.


example)

public class SimpleBean{

private String name;

private String age;


public void setName(String name) {

this.name = name;

}

public void getName(String age) {

this.age age;

}


public void getName(String name) {

return this.name;

}

public void getName(String age) {

return this.age;

}

}


일반 자바개발자들이 코딩하거나 이클립스를 통해 자동으로 생성하던 VO 개념의 Bean이 바로 POJO 이다.


하지만, 왜 Beans라고 말하지 않고 POJO라고 할까?

그 이유는 Beans라는 용어로 위 클래스를 정의하기에는 Java Beans나 EJB의 Beans와 구분이 모호하고 Beans라는 용어로 정의되는 여타 다른 개념들과의 확실한 분리를 위해 POJO라는 용어를 사용한 것이라 볼 수 있다.

'Server Enterprise > Java' 카테고리의 다른 글

[decompile] java decompiler  (0) 2014.12.30
[Encode] 한글 인코딩  (0) 2014.08.15
[Image Object] width, height  (0) 2014.03.11
[Java] System.getProperty() 에 관하여  (0) 2013.06.14
Java 멤버와 변수에 대한 고찰  (0) 2013.01.08

+ Recent posts