// TCP Client private Socket socket = null private BufferedInputStream bis; private BufferedOutputStream bos; // Socket TCP public boolean TcpServerConnect(String host, int port) { try { socket = new Socket(InetAddress.getByName(host), port); bis = new BufferedInputStream(socket.getInputStream()); bos = new BufferedOutputStream(socket.getOutputStream()); } catch(IOException e) { return false; } ..
문자열의 선언string str = "마음소프트";System.String str = "마음소프트";String str = "마음소프트";// 보통 첫번째인 string형으로 많이 선언하게 됩니다. 인덱스(Index)로 접근하기string str = "가나다라마바사";Response.Write( str[0] );// 결과는 첫번째 문자인 '가' 출력 문자열 추가string str1 = "반갑습니다. ";str1 = str1.Insert(str1.Length, "홍길동님");str1 = str1.Insert(0, "앗! ");Response.Write( str1 );// 결과는 '앗! 반갑습니다. 홍길동님' 출력string str3 = "마" + "음" + "소" + "프" + "트";Response.Wr..
import java.io.*; import java.util.regex.*; class Foo { public static void main(String[] args) { String s = "abcdoooooefghi"; try { if (s.matches(".*ooo.*")) System.out.format("매치되었습니다.%n"); else System.out.format("그런 문자열이 없습니다.%n"); } catch (PatternSyntaxException e) { // 정규식에 에러가 있다면 System.err.println(e); System.exit(1); } } }
import java.io.*; class WriteFile { public static void main(String args[]) { // 키보드로 입력받을 테이터를 임시로 저장할 버퍼를 생성. byte buffer[] = new byte[100]; try { System.out.println ("\n글을 다 썼으면 엔터를 치세요."); System.in.read(buffer);//버퍼의 데이터를 읽어 들인다. // FileOutputStream 객체를 생성. FileOutputStream fOut = new FileOutputStream("WriteFile.txt"); // FileOutputStream 객체를 이용해서 버퍼의 내용을 "WriteFile.txt"에 출력한다. fOut.write(bu..
package pkg.프로그램명; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; public class TCPClient { private Socket m_socket = null; private BufferedInputStream m_bis; private BufferedOutputStream m_bos; private final int BUFF_SIZE = 1024; public boolean Connect(String host, int port) { try { m_socke..
리눅스 서버와 TCP 통신시 서버쪽에서 로그를 한글로 저장시 깨지는 증상이 발생하여 방법을 찾게 되었다. 아래 설정이후 로그에서 한글이 깨지지 않는다. private BufferedReader m_bis; private BufferedOutputStream m_bos; // 전송 m_bos = new BufferedOutputStream(m_socket.getOutputStream()); public boolean SendMsg(String SendBuff) { try { m_bos.write(SendBuff.getBytes("EUC_KR")); // 한글 인코딩 m_bos.flush(); } catch(IOException e) { return false; } return true; } // 수신 m_..
void ShowEncoding() { // 기본 인코딩 확인 String enc = new java.io.OutputStreamWriter(System.out).getEncoding(); msgBox(enc); } // 메시지 박스 public void msgBox(String msg) { AlertDialog.Builder bld = new AlertDialog.Builder(this); bld.setTitle("사용자 인증"); // bld.setIcon(R.drawable.stats); bld.setMessage(msg); bld.setPositiveButton("닫 기", null); bld.show(); }
// java에서 테이블 생성 시 public boolean CreateTables() { boolean Flag = true; try { mDB.execSQL("CREATE TABLE IF NOT EXISTS alarm_info (" + "info_code INTEGER PRIMARY KEY AUTOINCREMENT, " + "title TEXT, " + "sun_repeat INTEGER, " + "mon_repeat INTEGER, " + "tue_repeat INTEGER, " + "wen_repeat INTEGER, " + "thu_repeat INTEGER, " + "fri_repeat INTEGER, " + "sat_repeat INTEGER " + "); "); mDB.execSQL("CR..
문자열 || 문자열
- Total
- Today
- Yesterday