KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > persist > impl > RawArrayInput


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

8
9 package com.sleepycat.persist.impl;
10
11 import java.util.IdentityHashMap JavaDoc;
12
13 import com.sleepycat.persist.raw.RawObject;
14
15 /**
16  * Extends RawAbstractInput to convert array (ObjectArrayFormat and
17  * PrimitiveArrayteKeyFormat) RawObject instances.
18  *
19  * @author Mark Hayes
20  */

21 class RawArrayInput extends RawAbstractInput {
22
23     private Object JavaDoc[] array;
24     private int index;
25     private Format componentFormat;
26
27     RawArrayInput(Catalog catalog,
28                   boolean rawAccess,
29                   IdentityHashMap JavaDoc converted,
30                   RawObject raw,
31                   Format componentFormat) {
32         super(catalog, rawAccess, converted);
33         array = raw.getElements();
34         this.componentFormat = componentFormat;
35     }
36
37     @Override JavaDoc
38     public int readArrayLength() {
39         return array.length;
40     }
41
42     @Override JavaDoc
43     Object JavaDoc readNext() {
44         Object JavaDoc o = array[index++];
45         return checkAndConvert(o, componentFormat);
46     }
47 }
48
Popular Tags