KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > logversion > Utils


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: Utils.java,v 1.6 2006/10/30 21:14:47 bostic Exp $
7  */

8
9 package com.sleepycat.je.logversion;
10
11 import com.sleepycat.je.DatabaseEntry;
12
13 public class Utils {
14
15     static final String JavaDoc DB1_NAME = "database1";
16     static final String JavaDoc DB2_NAME = "database2";
17     static final String JavaDoc MIN_VERSION_NAME = "minversion.jdb";
18     static final String JavaDoc MAX_VERSION_NAME = "maxversion.jdb";
19
20     static DatabaseEntry entry(int val) {
21
22         byte[] data = new byte[] { (byte) val };
23         return new DatabaseEntry(data);
24     }
25
26     static int value(DatabaseEntry entry) {
27
28         byte[] data = entry.getData();
29         if (data.length != 1) {
30             throw new IllegalStateException JavaDoc("len=" + data.length);
31         }
32         return data[0];
33     }
34 }
35
Popular Tags