• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2009-2010 jMonkeyEngine
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17  *   may be used to endorse or promote products derived from this software
18  *   without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 package com.jme3.export;
34 
35 import com.jme3.util.IntMap;
36 import java.io.IOException;
37 import java.nio.ByteBuffer;
38 import java.nio.FloatBuffer;
39 import java.nio.IntBuffer;
40 import java.nio.ShortBuffer;
41 import java.util.ArrayList;
42 import java.util.BitSet;
43 import java.util.Map;
44 
45 /**
46  * @author Joshua Slack
47  */
48 public interface InputCapsule {
49 
getSavableVersion(Class<? extends Savable> clazz)50     public int getSavableVersion(Class<? extends Savable> clazz);
51 
52     // byte primitive
53 
readByte(String name, byte defVal)54     public byte readByte(String name, byte defVal) throws IOException;
readByteArray(String name, byte[] defVal)55     public byte[] readByteArray(String name, byte[] defVal) throws IOException;
readByteArray2D(String name, byte[][] defVal)56     public byte[][] readByteArray2D(String name, byte[][] defVal) throws IOException;
57 
58     // int primitive
59 
readInt(String name, int defVal)60     public int readInt(String name, int defVal) throws IOException;
readIntArray(String name, int[] defVal)61     public int[] readIntArray(String name, int[] defVal) throws IOException;
readIntArray2D(String name, int[][] defVal)62     public int[][] readIntArray2D(String name, int[][] defVal) throws IOException;
63 
64 
65     // float primitive
66 
readFloat(String name, float defVal)67     public float readFloat(String name, float defVal) throws IOException;
readFloatArray(String name, float[] defVal)68     public float[] readFloatArray(String name, float[] defVal) throws IOException;
readFloatArray2D(String name, float[][] defVal)69     public float[][] readFloatArray2D(String name, float[][] defVal) throws IOException;
70 
71 
72     // double primitive
73 
readDouble(String name, double defVal)74     public double readDouble(String name, double defVal) throws IOException;
readDoubleArray(String name, double[] defVal)75     public double[] readDoubleArray(String name, double[] defVal) throws IOException;
readDoubleArray2D(String name, double[][] defVal)76     public double[][] readDoubleArray2D(String name, double[][] defVal) throws IOException;
77 
78 
79     // long primitive
80 
readLong(String name, long defVal)81     public long readLong(String name, long defVal) throws IOException;
readLongArray(String name, long[] defVal)82     public long[] readLongArray(String name, long[] defVal) throws IOException;
readLongArray2D(String name, long[][] defVal)83     public long[][] readLongArray2D(String name, long[][] defVal) throws IOException;
84 
85 
86     // short primitive
87 
readShort(String name, short defVal)88     public short readShort(String name, short defVal) throws IOException;
readShortArray(String name, short[] defVal)89     public short[] readShortArray(String name, short[] defVal) throws IOException;
readShortArray2D(String name, short[][] defVal)90     public short[][] readShortArray2D(String name, short[][] defVal) throws IOException;
91 
92 
93     // boolean primitive
94 
readBoolean(String name, boolean defVal)95     public boolean readBoolean(String name, boolean defVal) throws IOException;
readBooleanArray(String name, boolean[] defVal)96     public boolean[] readBooleanArray(String name, boolean[] defVal) throws IOException;
readBooleanArray2D(String name, boolean[][] defVal)97     public boolean[][] readBooleanArray2D(String name, boolean[][] defVal) throws IOException;
98 
99 
100     // String
101 
readString(String name, String defVal)102     public String readString(String name, String defVal) throws IOException;
readStringArray(String name, String[] defVal)103     public String[] readStringArray(String name, String[] defVal) throws IOException;
readStringArray2D(String name, String[][] defVal)104     public String[][] readStringArray2D(String name, String[][] defVal) throws IOException;
105 
106 
107     // BitSet
108 
readBitSet(String name, BitSet defVal)109     public BitSet readBitSet(String name, BitSet defVal) throws IOException;
110 
111 
112     // BinarySavable
113 
readSavable(String name, Savable defVal)114     public Savable readSavable(String name, Savable defVal) throws IOException;
readSavableArray(String name, Savable[] defVal)115     public Savable[] readSavableArray(String name, Savable[] defVal) throws IOException;
readSavableArray2D(String name, Savable[][] defVal)116     public Savable[][] readSavableArray2D(String name, Savable[][] defVal) throws IOException;
117 
118 
119     // ArrayLists
120 
readSavableArrayList(String name, ArrayList defVal)121     public ArrayList readSavableArrayList(String name, ArrayList defVal) throws IOException;
readSavableArrayListArray(String name, ArrayList[] defVal)122     public ArrayList[] readSavableArrayListArray(String name, ArrayList[] defVal) throws IOException;
readSavableArrayListArray2D(String name, ArrayList[][] defVal)123     public ArrayList[][] readSavableArrayListArray2D(String name, ArrayList[][] defVal) throws IOException;
124 
readFloatBufferArrayList(String name, ArrayList<FloatBuffer> defVal)125     public ArrayList<FloatBuffer> readFloatBufferArrayList(String name, ArrayList<FloatBuffer> defVal) throws IOException;
readByteBufferArrayList(String name, ArrayList<ByteBuffer> defVal)126     public ArrayList<ByteBuffer> readByteBufferArrayList(String name, ArrayList<ByteBuffer> defVal) throws IOException;
127 
128 
129     // Maps
130 
readSavableMap(String name, Map<? extends Savable, ? extends Savable> defVal)131     public Map<? extends Savable, ? extends Savable> readSavableMap(String name, Map<? extends Savable, ? extends Savable> defVal) throws IOException;
readStringSavableMap(String name, Map<String, ? extends Savable> defVal)132     public Map<String, ? extends Savable> readStringSavableMap(String name, Map<String, ? extends Savable> defVal) throws IOException;
readIntSavableMap(String name, IntMap<? extends Savable> defVal)133     public IntMap<? extends Savable> readIntSavableMap(String name, IntMap<? extends Savable> defVal) throws IOException;
134 
135     // NIO BUFFERS
136     // float buffer
137 
readFloatBuffer(String name, FloatBuffer defVal)138     public FloatBuffer readFloatBuffer(String name, FloatBuffer defVal) throws IOException;
139 
140 
141     // int buffer
142 
readIntBuffer(String name, IntBuffer defVal)143     public IntBuffer readIntBuffer(String name, IntBuffer defVal) throws IOException;
144 
145 
146     // byte buffer
147 
readByteBuffer(String name, ByteBuffer defVal)148     public ByteBuffer readByteBuffer(String name, ByteBuffer defVal) throws IOException;
149 
150 
151     // short buffer
152 
readShortBuffer(String name, ShortBuffer defVal)153     public ShortBuffer readShortBuffer(String name, ShortBuffer defVal) throws IOException;
154 
155 
156     // enums
157 
readEnum(String name, Class<T> enumType, T defVal)158     public <T extends Enum<T>> T readEnum(String name, Class<T> enumType, T defVal) throws IOException;
159 
160 }