diff options
| author | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-07-20 20:00:05 +0100 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-07-20 20:00:05 +0100 |
| commit | 3ef782d3745ea8f25a3151561a3cfb882190210e (patch) | |
| tree | 86b9c2f5fde051dd0bced99b3fc9f5a3ba08db69 /lang/java/src/com/sleepycat/persist/impl/RawArrayInput.java | |
| download | berkeleydb-3ef782d3745ea8f25a3151561a3cfb882190210e.tar.gz | |
Tarball conversion
Diffstat (limited to 'lang/java/src/com/sleepycat/persist/impl/RawArrayInput.java')
| -rw-r--r-- | lang/java/src/com/sleepycat/persist/impl/RawArrayInput.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lang/java/src/com/sleepycat/persist/impl/RawArrayInput.java b/lang/java/src/com/sleepycat/persist/impl/RawArrayInput.java new file mode 100644 index 00000000..8907bc1a --- /dev/null +++ b/lang/java/src/com/sleepycat/persist/impl/RawArrayInput.java @@ -0,0 +1,47 @@ +/*- + * See the file LICENSE for redistribution information. + * + * Copyright (c) 2002, 2012 Oracle and/or its affiliates. All rights reserved. + * + */ + +package com.sleepycat.persist.impl; + +import com.sleepycat.persist.raw.RawObject; +import java.util.IdentityHashMap; + +/** + * Extends RawAbstractInput to convert array (ObjectArrayFormat and + * PrimitiveArrayteKeyFormat) RawObject instances. + * + * @author Mark Hayes + */ +class RawArrayInput extends RawAbstractInput { + + private Object[] array; + private int index; + private Format componentFormat; + + RawArrayInput(Catalog catalog, + boolean rawAccess, + IdentityHashMap converted, + RawObject raw, + Format componentFormat) { + super(catalog, rawAccess, converted); + array = raw.getElements(); + this.componentFormat = componentFormat; + } + + @Override + public int readArrayLength() { + return array.length; + } + + @Override + Object readNext() + throws RefreshException { + + Object o = array[index++]; + return checkAndConvert(o, componentFormat); + } +} |
