• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/test/scr024/src/com/sleepycat/bind/serial/test/
1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002,2008 Oracle.  All rights reserved.
5 *
6 * $Id: NullClassCatalog.java,v 12.8 2008/02/07 17:12:29 mark Exp $
7 */
8
9package com.sleepycat.bind.serial.test;
10
11import java.io.ObjectStreamClass;
12import java.math.BigInteger;
13
14import com.sleepycat.db.DatabaseException;
15import 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 */
24class NullClassCatalog implements ClassCatalog {
25
26    private long id = Long.MAX_VALUE;
27
28    public void close()
29        throws DatabaseException {
30    }
31
32    public byte[] getClassID(ObjectStreamClass classFormat)
33        throws DatabaseException {
34
35        return BigInteger.valueOf(id--).toByteArray();
36    }
37
38    public ObjectStreamClass getClassFormat(byte[] classID)
39        throws DatabaseException, ClassNotFoundException {
40
41        return null; // ObjectInput not supported
42    }
43}
44