易截截图软件、单文件、免安装、纯绿色、仅160KB

在java中使用key value型数据库Berkeley DB

除了关系型数据库外,还有key-value型数据库可以选择,在大型的查询系统中,key-value型数据库可以出色的完成某些任务。
Oracle的Berkeley DB就是一种key-value型数据库,本文简要介绍在java中使用Berkeley DB。
PartKey.java:
import java.io.Serializable;
public class PartKey implements Serializable
{
private String number;
public PartKey(String number) {
this.number = number;
}
public final String getNumber() {
return number;
}
public String toString() {
return "[PartKey: number=" + number + ']';
}
}
Weight.java
public class Weight implements Serializable
{
public final static String GRAMS = "grams";
public final static String OUNCES = "ounces";
private double amount;
private String units;
public Weight(double amount, String units)
{
this.amount = amount;
this.units = units;
}
public final double getAmount()
{
return amount;
}
public final String getUnits()
{
return units;
}
public String toString()
{
return "[" + amount + ' ' + units + ']';
}
}
PartData.java
public class PartData implements Serializable
{
private String name;
private String color;
private Weight weight;
private String city;
public PartData(String name, String color, Weight weight, String city)
{
this.name = name;
this.color = color;
this.weight = weight;
this.city = city;
}
public final String getName()
{
return name;
}
public final String getColor()
{
return color;
}
public final Weight getWeight()
{
return weight;
}
public final String getCity()
{
return city;
}
public String toString()
{
return "[PartData: name=" + name +
" color=" + color +
" weight=" + weight +
" city=" + city +


相关文档:

Java I/O常用流示例


package io;   
import java.io.*;   
/**  
* @author 高枕吴忧  
* 利用缓冲区原理,BufferedInputStream,  
* 实现的文件字节流读取功能示范  
*  
*/  
public class BufferedInOutputStream {  & ......

将Java对象保存为XML文档

package com.kiloway.trace.utils;
import java.lang.reflect.Field;
/**
* @author Zhang Qi
* @Create Time 2010/01/09
* */
public class ObjectToXML {
public String toString(Object object) throws Exception {
StringBuilder sb = new StringBuilder();
//得到类的名称
String classname = obj ......

Java数据库编程


第一章:java对象持久化技术概述
1:持久化:persistence;对象持久化包含两方面的内容:将内存数据存入长期记忆介质并能从这些介质上无差错地复原到内存。
2:通过实现java.io包中的Serializable接口(即对象序列化和饭序列化技术)实现,这种技术很重要,虽然在执行持久化时有极大的限制,如:效率低下、不支持事务等 ......

java 不定参数使用示例

public class javaTest {
public static void test(String ...strings){
for(String str: strings){
System.out.print(str + " ");
}
System.out.println();
}

public static void main(String[] args){
test("a", "b", "c", "ddd");
test( ......

实现AMF3与Java之间数组的传递(动态创建数组)...

首先,AMF3似乎并不支持List.ArrayList等数组的解析...Java客户端传递List对象,AMF3无法解析为Array...
原因是:AMF3只支持基础数据类型...
故,需要将List等数据转换为Object[] !这样AMF3才能将Java传递的数组解析为Array...
由于数组的创建,即便一开始不赋值,也需要设置数组的length,如:String[] myString = new Str ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号