Debian Codegraph @

lang/java/src/com/sleepycat/persist/impl/RawArrayInput.java

raw
1 /*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002, 2013 Oracle and/or its affiliates. All rights reserved.
5 *
6 */
7
8 package com.sleepycat.persist.impl;
9
10 import com.sleepycat.persist.raw.RawObject;
11 import java.util.IdentityHashMap;
12
13 /**
14 * Extends RawAbstractInput to convert array (ObjectArrayFormat and
15 * PrimitiveArrayteKeyFormat) RawObject instances.
16 *
17 * @author Mark Hayes
18 */
19 class RawArrayInput extends RawAbstractInput {
20
21 private Object[] array;
22 private int index;
23 private Format componentFormat;
24
25 RawArrayInput(Catalog catalog,
26 boolean rawAccess,
27 IdentityHashMap converted,
28 RawObject raw,
29 Format componentFormat) {
30 super(catalog, rawAccess, converted);
31 array = raw.getElements();
32 this.componentFormat = componentFormat;
33 }
34
35 @Override
36 public int readArrayLength() {
37 return array.length;
38 }
39
40 @Override
41 Object readNext()
42 throws RefreshException {
43
44 Object o = array[index++];
45 return checkAndConvert(o, componentFormat);
46 }
47 }