ImageVerifierCode 换一换
格式:DOCX , 页数:16 ,大小:274.39KB ,
资源ID:6638084      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6638084.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(java小知识.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

java小知识.docx

1、java小知识常见的返回类型可以分为2种: 1、基本数据类型基本数据类型又可以分为3小类:整型数据类型,布尔数据类型,浮点型数据类型整型数据类型:byte(1个字节)-字节型 short(2个字节)-短整型char(2个字节)-字符型int(4个字节)-整型long(8个字节)-长整型 布尔类型:boolean(1个字节)-布尔型浮点型:float(4个字节)-单精度浮点型double(8个字节)-双精度浮点型2、对象类型: 1)自定义的对象类型2)类库类型每一种返回类型都有默认值:int:0byte:0char:/u0000(在控制台显示为一个方格)short:0long:0boolean:

2、falsefloat:0.0Double:0.0Object:null java自定义文件操作类实例代码2010-09-20 08:45:04 我来说两句 收藏 我要投稿 1. package cn.edu.tongji.cims.wade.system; 2. import java.io.*; 3. 4. public class FileOperate 5. public FileOperate() 6. 7. 8. /* 9. * 新建目录 10. * param folderPath String 如 c:/fqf 11. * return boolean 12. */ 13. pu

3、blic void newFolder(String folderPath) 14. try 15. String filePath = folderPath; 16. filePath = filePath.toString(); 17. java.io.File myFilePath = new java.io.File(filePath); 18. if (!myFilePath.exists() 19. myFilePath.mkdir(); 20. 21. 22. catch (Exception e) 23. System.out.println(新建目录操作出错); 24. e.

4、printStackTrace(); 25. 26. 27. 28. /* 29. * 新建文件 30. * param filePathAndName String 文件路径及名称 如c:/fqf.txt 31. * param fileContent String 文件内容 32. * return boolean 33. */ 34. public void newFile(String filePathAndName, String fileContent) 35. 36. try 37. String filePath = filePathAndName; 38. filePath

5、= filePath.toString(); 39. File myFilePath = new File(filePath); 40. if (!myFilePath.exists() 41. myFilePath.createNewFile(); 42. 43. FileWriter resultFile = new FileWriter(myFilePath); 44. PrintWriter myFile = new PrintWriter(resultFile); 45. String strContent = fileContent; 46. myFile.println(strC

6、ontent); 47. resultFile.close(); 48. 49. catch (Exception e) 50. System.out.println(新建目录操作出错); 51. e.printStackTrace(); 52. 53. 54. 55. 56. /* 57. * 删除文件 58. * param filePathAndName String 文件路径及名称 如c:/fqf.txt 59. * param fileContent String 60. * return boolean 61. */ 62. public void delFile(String f

7、ilePathAndName) 63. try 64. String filePath = filePathAndName; 65. filePath = filePath.toString(); 66. java.io.File myDelFile = new java.io.File(filePath); 67. myDelFile.delete(); 68. 69. 70. catch (Exception e) 71. System.out.println(删除文件操作出错); 72. e.printStackTrace(); 73. 74. 75. 76. /* 77. * 删除文件

8、夹 78. * param filePathAndName String 文件夹路径及名称 如c:/fqf 79. * param fileContent String 80. * return boolean 81. */ 82. public void delFolder(String folderPath) 83. try 84. delAllFile(folderPath); /删除完里面所有内容 85. String filePath = folderPath; 86. filePath = filePath.toString(); 87. java.io.File myFilePa

9、th = new java.io.File(filePath); 88. myFilePath.delete(); /删除空文件夹 89. 90. catch (Exception e) 91. System.out.println(删除文件夹操作出错); 92. e.printStackTrace(); 93. 94. 95. 96. /* 97. * 删除文件夹里面的所有文件 98. * param path String 文件夹路径 如 c:/fqf 99. */ 100. public void delAllFile(String path) 101. File file = new

10、File(path); 102. if (!file.exists() 103. return; 104. 105. if (!file.isDirectory() 106. return; 107. 108. String tempList = file.list(); 109. File temp = null; 110. for (int i = 0; i tempList.length; i ) 111. if (path.endsWith(File.separator) 112. temp = new File(path tempListi); 113. 114. else 115.

11、 temp = new File(path File.separator tempListi); 116. 117. if (temp.isFile() 118. temp.delete(); 119. 120. if (temp.isDirectory() 121. delAllFile(path / tempListi);/先删除文件夹里面的文件 122. delFolder(path / tempListi);/再删除空文件夹 123. 124. 125. 126. 127. /* 128. * 复制单个文件 129. * param oldPath String 原文件路径 如:c:/

12、fqf.txt 130. * param newPath String 复制后路径 如:f:/fqf.txt 131. * return boolean 132. */ 133. public void copyFile(String oldPath, String newPath) 134. try 135. int bytesum = 0; 136. int byteread = 0; 137. File oldfile = new File(oldPath); 138. if (oldfile.exists() /文件存在时 139. InputStream inStream = new

13、 FileInputStream(oldPath); /读入原文件 140. FileOutputStream fs = new FileOutputStream(newPath); 141. byte buffer = new byte1444; 142. int length; 143. while ( (byteread = inStream.read(buffer) != -1) 144. bytesum = byteread; /字节数 文件大小 145. System.out.println(bytesum); 146. fs.write(buffer, 0, byteread);

14、 147. 148. inStream.close(); 149. 150. 151. catch (Exception e) 152. System.out.println(复制单个文件操作出错); 153. e.printStackTrace(); 154. 155. 156. 157. /* 158. * 复制整个文件夹内容 159. * param oldPath String 原文件路径 如:c:/fqf 160. * param newPath String 复制后路径 如:f:/fqf/ff 161. * return boolean 162. */ 163. public vo

15、id copyFolder(String oldPath, String newPath) 164. 165. try 166. (new File(newPath).mkdirs(); /如果文件夹不存在 则建立新文件夹 167. File a=new File(oldPath); 168. String file=a.list(); 169. File temp=null; 170. for (int i = 0; i file.length; i ) 171. if(oldPath.endsWith(File.separator) 172. temp=new File(oldPath f

16、ilei); 173. 174. else 175. temp=new File(oldPath File.separator filei); 176. 177. 178. if(temp.isFile() 179. FileInputStream input = new FileInputStream(temp); 180. FileOutputStream output = new FileOutputStream(newPath / 181. (temp.getName().toString(); 182. byte b = new byte1024 * 5; 183. int len;

17、 184. while ( (len = input.read(b) != -1) 185. output.write(b, 0, len); 186. 187. output.flush(); 188. output.close(); 189. input.close(); 190. 191. if(temp.isDirectory()/如果是子文件夹 192. copyFolder(oldPath / filei,newPath / filei); 193. 194. 195. 196. catch (Exception e) 197. System.out.println(复制整个文件夹

18、内容操作出错); 198. e.printStackTrace(); 199. 200. 201. 202. 203. /* 204. * 移动文件到指定目录 205. * param oldPath String 如:c:/fqf.txt 206. * param newPath String 如:d:/fqf.txt 207. */ 208. public void moveFile(String oldPath, String newPath) 209. copyFile(oldPath, newPath); 210. delFile(oldPath); 211. 212. 213. 2

19、14. /* 215. * 移动文件到指定目录 216. * param oldPath String 如:c:/fqf.txt 217. * param newPath String 如:d:/fqf.txt 218. */ 219. public void moveFolder(String oldPath, String newPath) 220. copyFolder(oldPath, newPath); 221. delFolder(oldPath); 222. 223. 224. 告:博客新增直接引用代码功能 专访李铁军:从医生到金山首席安全专家的转变 CSDN博客频道自定义域名、

20、标签搜索功能上线啦! 独一无二的职位:开源社区经理 前端常用的获取参数的方法 2012-07-20 15:54 50人阅读 评论(0) 收藏 举报 url服务器目录(?)-1. BasePath2. 获取应用服务名BasePathString basePath = request.getScheme()+:/+request.getServerName()+:+request.getServerPort();这其实就是 获得应用的根url,比如说你的应用的根路径是 http:/localhost:8080,那么你列出的代码就是为basePath赋值为 http:/localhost:8080。

21、1、request.getScheme() 返回协议的名称 http,和后面的:/ 拼起来就成了 http:/ 2、request.getServerName() 这是获取你的服务器的名称,如果你的应用部署在本机那么其就返回localhost或者127.0.0.1 ,这2个是等价的3、request.getServerPort() 是你应用使用的端口,比如8080或者80 等等 上面3点的结果拼起来就构成了你应用的根路径或者说是根url获取应用服务名$pageContext.request.contextPath”的作用是取出部署的应用程序名,这样不管如何部署,所用路径都是正确的。struts

22、中关于Json的配置 2012-07-19 11:28 391人阅读 评论(0) 收藏 举报 jsonstrutsinterceptorclass编程 .以上为常规编程中JSON的配置,但是疑惑是其extends的名字json-default可否置换?json-default其实也是最终继承struts-default的 json-plugn中struts-plugn.xml源码如下: 这里你可以看到这个json-default是干了什么事情,无非就是:1 加了个名为json的result类型2 加了一层名为json的拦截器所以对于此类问题,可以说 不继承json-default ,可以,但是

23、你必须在你的struts.xml中添加一个resultType 也就是在你的struts.xml 的节点下添加以下内容: -这里的name就按照你喜欢的取了 也就是你的第二个问题 然后在你配置的拦截器声明中加上 也就是json拦截器的声明,接下来再在你的default-stack-ref(或者其他拦截器引用的地方)引用这个名字为json的拦截器就可以了教程 两台笔记本无线共享上网 分类: 程序人生 2011-07-26 17:55 134人阅读 评论(0) 收藏 举报 网络dns服务器internetdllwindows加密家里有两台笔记本,一个宽带网端口,一条网线,如何实现两台笔记本同时上网

24、?下面就介绍一种笔记本无线共享上网的方法,具体步骤如下(以下为XP系统下的设置,Vista设置程序与此类似)。首先,选择其中一台笔记本当做主机。打开主机的“网络连接”,选择“无线网络连接”,右键打开属性对话框,在“常规”选项卡下,双击“TCP/IP 协议”。配置 IP 地址和子网掩码分别为 192.168.0.1 和 255.255.255.0 (如图),其他的不需要设置,如显示与宽带IP冲突时,请重新启动计算机后再试。然后,再点击主机的“无线网络连接属性”窗口的“无线网络配置”,选中“用windows配置我的无线网络设置”,点击下方的“高级”,在要访问的网络里,勾上“仅计算机到计算机(待定)

25、”,不要勾选“自动连接到非首选的网络”。如图:建立一个无线虚拟AP,这步是关键。在主机“无线网络配置”选项卡里,首选网络下,点击“添加”,为主机添加一个SSID:自定义网络名为“dll”,网络验证:开放式,数据加密:WEB,网络密钥:可以输入5或13位ASCII字符 或 10或26位十六进制字符,不要勾选“自动为我提供此密钥。也可不设置密钥,但出于无线局域网的安全考虑,一般不建议进行此操作配置主机“宽带连接属性”中的“高级”选项卡 。勾选“允许其他用户通过此计算机的Internet来连接”和“每当网络上的计算机试图访问Internet时建立一个拨号连接”。分机设置十分简单。重复步骤一,设置“TCP/IP 协议属性“,为”自动获得IP地址“和”自动获得DNS服务器地址“。点击”确定“。鼠标右键点击 “无线网络连接”,选择“查看可用的无线连接”,搜索到刚才新建的无线网络“dll”,点击连接(主机和分机执行相同的动作),则无线局域共享设置成功。这个时候我们在每台计算机上查看右下角的无线图标就会发现显示的是“无线网络连接,速度54Mbps,信号强度非常好,状态已连接上”。两台笔记本就可以同时上网了。

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1