ITeye博客

JAVA BASIC

共 34 篇文章

网络知识定向,扫盲

TCP/IP、Http、Socket的区别 http://jingyan.baidu.com/article/08b6a591e07ecc14a80922f1.html 多播 http://li-sir.iteye.com/blog/837344 心跳检测 http://weixiaolu.iteye.com/blog/1544860 http://weixiaolu.iteye.com/blog/1504898 http://weixiaolu.iteye.com/blog/1479656 traceroute详解 http://www.exit109.com/~jeremy/news/p…

2015-05-06 20:14 · JAVA BASIC

java.net.socketinputstream.socketread0 hangs thread

http://javaeesupportpatterns.blogspot.jp/2011/04/javanetsocketinputstreamsocketread0.html http://thushw.blogspot.jp/2010/10/java-urlconnection-provides-no-fail.html

2015-04-29 16:25 · JAVA BASIC

使用Hibernate Validator 完成 字段的自动验证

如题 1. maven 中引入 <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.2.0.Final</version> </dependency> 2.使用 public class Content { @NotNull private String name; @Pattern(regexp="//d") private String amountAndUnit; private double price; } 3. 验证 public…

2014-11-13 18:23 · JAVA BASIC

JAVA 序列化

再读序列化 http://www.blogjava.net/jiangshachina/archive/2012/02/13/369898.html

2014-05-11 18:06 · JAVA BASIC

synchronized (obj) 锁住不同的对象的话

Obj package com.james.thread.sync; public class SyncObject { byte[] lock1 = new byte[0]; byte[] lock2 = new byte[0]; int i = 1; public int minus() { try { synchronized (lock1) { System.out.println("minus in"); Thread.currentThread().sleep(300); i--; System.out.println("minus " + i); } } catch (Inte…

2014-03-27 08:58 · JAVA BASIC

annotation 生成代码(命令行,Eclipse,Maven下运行)

what is annotation ? http://www.java2s.com/Tutorial/Java/0020__Language/AnnotationsandAnnotationTypes.htm 引用自 http://deors.wordpress.com/2011/10/08/annotation-processors/ 需要中文翻译,请留言。 Use Apache Velocity as the template of java class http://velocity.apache.org/

2013-01-04 15:19 · JAVA BASIC

越挖越有意思,annotation generate code --> create eclipse plugin -->osgi

越挖越有意思,annotation generate code --> create eclipse plugin -->osgi 1. eclipse 插件开发入门 (引自) http://www.cnblogs.com/liuzhuo/category/257208.html

2012-12-27 16:42 · JAVA BASIC

annotation 学习

basic ENGLISH: http://www.codeproject.com/Articles/272736/Understanding-Annotations-in-Java 中文版 引用 http://www.blogjava.net/weidagang2046/articles/27958.html eclipse下使用APT http://www.eclipse.org/jdt/apt/introToAPT.html eclipse使用APT生成代码 http://code.google.com/p/acris/wiki/AnnotationProcessing_Eclipse…

2012-12-27 13:57 · JAVA BASIC

execute bat file in java

String path="cmd /c start d:\\sample\\sample.bat"; Runtime rn=Runtime.getRuntime(); Process pr=rn.exec(path);` /c start

2012-12-24 15:38 · JAVA BASIC

字符串匹配问题

转自 http://weijinxian.iteye.com/blog/1582675 今天需要处理很多的字符串匹配问题。 在涉及到regexp时发现"$"得特别处理,具体的如在replaceAll中或者split中要想处理"$",得写成"//$". 另外,对于"|",即竖线的处理也得注意,应该是"[|]". why???

2012-07-16 14:07 · JAVA BASIC

inherit

继承父类的实例方法是覆盖,而且继承静态方法则是隐藏。 隐藏意味着,你还可以调用到父类的被隐藏的方法。 Instance Methods An instance method in a subclass with the same signature (name, plus the number and the type of its parameters) and return type as an instance method in the superclass overrides the superclass's method. Class Methods If a subclass …

2012-07-03 00:00 · JAVA BASIC

内部类的继承从而实现对父类的private字段的引用

子类 public class SubClass extends SuperClass.InnerClass { SuperClass superClass; public SubClass (SuperClass superClass){ superClass.super(); //由于内部类构建器必须同封装类对象的一个句柄联系到一起, //所以从一个内部类继承的时候这里建立一个句柄 this.superClass = superClass; } public void show(){ System.out.println(this.returnPrivates()); } } 父类: 有…

2012-07-02 23:38 · JAVA BASIC

interface

http://docs.oracle.com/javase/tutorial/java/IandI/interfaceDef.html An interface declaration consists of modifiers, the keyword interface , the interface name, a comma-separated list of parent interfaces (if any), and the interface body. For example: public interface GroupedInterface extends Interf…

2012-07-01 23:34 · JAVA BASIC

java.util.ResourceBundle使用详解(转)

转 java.util.ResourceBundle使用详解 java.util.ResourceBundle使用详解 一、认识国际化资源文件 这个类提供软件国际化的捷径。通过此类,可以使您所编写的程序可以: 轻松地本地化或翻译成不同的语言 一次处理多个语言环境 以后可以轻松地进行修改,支持更多的语言环境 说的简单点,这个类的作用就是读取资源属性文件(properties),然后根据.properties文件的名称信息(本地化信息),匹配当前系统的国别语言信息(也可以程序指定),然后获取相应的properties文件的内容。 使用这个类,要注意的一点是,这个properties文件的名字是有…

2012-06-12 16:27 · JAVA BASIC

对两个LIST对行比对,筛选

对两个LIST对行比对,筛选 以下两种方法比对中会发现用情况 (单位 ns) CollectionUtils ListUtils 52354 811485 49659 790698 package com.collection; import java.util.*; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.ListUtils; public class ListFilter { public static void main(String[] a…

2011-12-26 16:00 · JAVA BASIC

java程序代理上网

哎,在网上搜好久 看来网上还是有很多 吭爹 的,害我搞了好久 发一个能用的 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; public class ProxyConnection{ public static void main(String[] args) { try { //代理服务器地址以及端口 System.setPropert…

2011-12-05 15:34 · JAVA BASIC

PO/VO/DTO/DAO/POJO 名词解惑

PO/VO/DTO/DAO/POJO 名词解惑 很多时候都是模糊的印象,今天好好学习一下 来自 :低着头向前跑的ITEYE http://kangsg219.iteye.com/blog/187553 原文来自:野蔷薇 http://www.yeqiangwei.com/club/f4b0l0fp1t342010p1.html PO:persistant object持久对象,可以看成是与数据库中的表相映射的java对象。最简单的PO就是对应数据库中某个表中的一条记录,多个记录可以用PO的集合。PO中应该不包含任何对数据库的操作. VO:value object值对象。通常用于业务层之间的数…

2011-10-25 10:43 · JAVA BASIC

中文的正则表达式

此表达式也行 \\p{InCJKUnifiedIdeographs}&&\\P{Cn}]] http://www.24xuexi.com/w/2011-05-11/89578.html 匹配中文字符的正则表达式: [u4e00-u9fa5]( 转) http://blog.csdn.net/xiaofan_sap/article/details/4810815 评注:匹配中文还真是个头疼的事,有了这个表达式就好办了 匹配双字节字符(包括汉字在内):[^x00-xff] 评注:可以用来计算字符串的长度(一个双字节字符长度计2,ASCII字符计1) 匹配空白行的正则表达式:ns*r 评注:可以用…

2011-09-27 10:56 · JAVA BASIC

基础JAVA IO 详解(转)

JAVA IO http://developer.51cto.com/art/201109/292225.htm

2011-09-22 12:36 · JAVA BASIC

question in reading java reflect

1. create the dynamic instance for what ? for get the methods , fields ,constructors .... 2. if the modifers of the method is private/protected , will the method be reflected ? **getMethod ---**Returns a Method object that reflects the specified public member method of the class or interface repres…

2011-08-24 10:15 · JAVA BASIC