01: /*
02: * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
03: * (http://h2database.com/html/license.html).
04: * Initial Developer: H2 Group
05: */
06: package org.h2.value;
07:
08: import org.h2.constant.SysProperties;
09:
10: /**
11: * Implementation of the OBJECT data type.
12: */
13: public class ValueJavaObject extends ValueBytesBase {
14:
15: private static final ValueJavaObject EMPTY = new ValueJavaObject(
16: new byte[0]);
17:
18: protected ValueJavaObject(byte[] v) {
19: super (v);
20: }
21:
22: public static ValueJavaObject getNoCopy(byte[] b) {
23: if (b.length == 0) {
24: return EMPTY;
25: }
26: ValueJavaObject obj = new ValueJavaObject(b);
27: if (b.length > SysProperties.OBJECT_CACHE_MAX_PER_ELEMENT_SIZE) {
28: return obj;
29: }
30: return (ValueJavaObject) Value.cache(obj);
31: }
32:
33: public int getType() {
34: return Value.JAVA_OBJECT;
35: }
36:
37: }
|