01: /*-
02: * See the file LICENSE for redistribution information.
03: *
04: * Copyright (c) 2002,2008 Oracle. All rights reserved.
05: *
06: * $Id: NullClassCatalog.java,v 1.17.2.3 2008/01/07 15:14:22 cwl Exp $
07: */
08:
09: package com.sleepycat.bind.serial.test;
10:
11: import java.io.ObjectStreamClass;
12: import java.math.BigInteger;
13:
14: import com.sleepycat.je.DatabaseException;
15: import com.sleepycat.bind.serial.ClassCatalog;
16:
17: /**
18: * NullCatalog is a dummy Catalog implementation that simply
19: * returns large (8 byte) class IDs so that ObjectOutput
20: * can be simulated when computing a serialized size.
21: *
22: * @author Mark Hayes
23: */
24: class NullClassCatalog implements ClassCatalog {
25:
26: private long id = Long.MAX_VALUE;
27:
28: public void close() throws DatabaseException {
29: }
30:
31: public byte[] getClassID(ObjectStreamClass classFormat)
32: throws DatabaseException {
33:
34: return BigInteger.valueOf(id--).toByteArray();
35: }
36:
37: public ObjectStreamClass getClassFormat(byte[] classID)
38: throws DatabaseException, ClassNotFoundException {
39:
40: return null; // ObjectInput not supported
41: }
42: }
|