Java读取文件的简单代码
网址: http://blog.csdn.net/justinavril/archive/2008/08/06/2775767.aspx
import
java.io.*;
public
class
FileToString {
public
static
String readFile(String fileName) {
String output = ""
;
File file = new
File(fileName);
if
(file.exists()){
if
(file.isFile()){
try
{
BufferedReader input = new
BufferedReader (
new
FileReader(file));
StringBuffer buffer = new
StringBuffer();
String text;
while
((text = input.readLine()) !=
null
)
&n
相关文档:
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.logging.Logger; ......
1. byte 如果没有赋值,那么java会自动将它赋值为 (byte)0;
static String ReadLn (int maxLg) // utility function to read from stdin
{
byte lin[] = new byte [maxLg];
int lg = 0, car = -1;
String line = "";
try
{
while (lg < maxLg)
......
Java
中的常量
常量就是程序里持续不变的值,它是不能改变的数据。
Java
中的常量包含整型常量、浮点数常量、布尔常量等,下面来看一下它们是如何表示的:
整型常量
整型常量可以分为十进制
、十六进制
和八进制
。
十进制
:
0 1 2 3 4 5 6 7 8 9
注意
:以十进制表示时,第一位不能是
0
(数字 ......
处理乱码问题
1、规范数据库和页面所有编码统一为一种例如utf-8
2、hibernate连接数据库设置连接编码
<session-factory>
<property name="connection.url">
jdbc:mysql://127.0.0.1:3306/leaveword?useUnicode=true&characterEncoding=utf-8
& ......
本文主要通过两台机器,搭建MQ消息传输的环境,并编写测试程序进行测试。
第一、准备工作
准备2台Win2000环境(XP也可),通过以太网连通。
机器A:代码为00000000,IP地址为:10.1.1.1
机器B:代码为88888888,IP地址为:10.1.1.2
安装MQ 5.3
第二、创建MQ对象
A机器上:
1、打开“WebSphere MQ资源管理器&rd ......