Java高级数据类型
来源:互联网 发布:巨人网络 股票分析 编辑:程序博客网 时间:2024/06/11 20:44
Blob:
写入:
FileInputStream fis = new FileInputStream(file);
pstmt.setBinaryStream(1, fis, (int) file.length());
... pstmt.close();
fis.close();
读取:
Blob blob = rs.getBlob("photo");
ImageIcon icon = new ImageIcon(blob.getBytes(1, (int)blob.length()));
JLabel lPhoto = new JLabel(icon);
setLayout(new GridLayout(1, 1));
add(lPhoto);
Clob:
写入:
FileInputStream fis = new FileInputStream(file);
pstmt.setAsciiStream(1, fis, (int)file.length());
读取:
Clob clob = rs.getClob("memo");
InputStreamReader in = new InputStreamReader(clob.getAsciiStream());
JTextArea text = new JTextArea(readString(in));
setLayout(new GridLayout(1, 1));
add(text);
public static String readString(InputStreamReader in) throws IOException {
StringBuffer buf = new StringBuffer();
int n;
char[] b = new char[1024];
while((n = in.read(b)) > 0)
buf.append(b, 0, n);
return buf.toString();
}
写入:
FileInputStream fis = new FileInputStream(file);
pstmt.setBinaryStream(1, fis, (int) file.length());
... pstmt.close();
fis.close();
读取:
Blob blob = rs.getBlob("photo");
ImageIcon icon = new ImageIcon(blob.getBytes(1, (int)blob.length()));
JLabel lPhoto = new JLabel(icon);
setLayout(new GridLayout(1, 1));
add(lPhoto);
Clob:
写入:
FileInputStream fis = new FileInputStream(file);
pstmt.setAsciiStream(1, fis, (int)file.length());
读取:
Clob clob = rs.getClob("memo");
InputStreamReader in = new InputStreamReader(clob.getAsciiStream());
JTextArea text = new JTextArea(readString(in));
setLayout(new GridLayout(1, 1));
add(text);
public static String readString(InputStreamReader in) throws IOException {
StringBuffer buf = new StringBuffer();
int n;
char[] b = new char[1024];
while((n = in.read(b)) > 0)
buf.append(b, 0, n);
return buf.toString();
}
- Java高级数据类型
- JAVA常用的高级数据类型
- 高级数据类型-python
- C++/C高级数据类型
- 高级C数据类型
- python高级数据类型
- 数据类型(基本+高级)
- SQL 数据类型 高级教程
- hive 高级数据类型使用
- SQL高级语句-数据类型
- 《Javascript高级编程》 数据类型
- JDBC 高级数据类型的应用
- JDBC 高级数据类型的应用
- SQL 高级(8) 数据类型
- 学习Python语言---高级数据类型
- JAVA高级01_04 基本数据类型的对象包装类 2011-4-20
- java高级
- java高级
- 打包传输结构体或大内存块
- 基于Win32 console的MSXML读取中文的问题解决过程
- 测试工具小结
- 以编程方式使用批语句节省 数据库 IO 来提高性能
- [学习笔记]Thinking in Java (the 2nd edition) Study Note (1)
- Java高级数据类型
- C++Builder 数据库程序设计开发详解
- 2004年,我们关注的新闻—IT
- VC中利用ATL OLE DB类开发Access数据库的技巧
- Visual Studio .Net团队开发
- 网中漫步 XP SP2 VOL 全自动安装启动光盘2005年新春贺岁版
- 爸爸,我怀了你的孩子(10-15)(转贴,伤感的故事)
- 在ATL DLL中传递C++对象
- 爸爸,我怀了你的孩子(6-9)(转贴,这是一个感人的故事)