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 OutputCapsule { 49 50 // byte primitive 51 write(byte value, String name, byte defVal)52 public void write(byte value, String name, byte defVal) throws IOException; write(byte[] value, String name, byte[] defVal)53 public void write(byte[] value, String name, byte[] defVal) throws IOException; write(byte[][] value, String name, byte[][] defVal)54 public void write(byte[][] value, String name, byte[][] defVal) throws IOException; 55 56 57 // int primitive 58 write(int value, String name, int defVal)59 public void write(int value, String name, int defVal) throws IOException; write(int[] value, String name, int[] defVal)60 public void write(int[] value, String name, int[] defVal) throws IOException; write(int[][] value, String name, int[][] defVal)61 public void write(int[][] value, String name, int[][] defVal) throws IOException; 62 63 64 // float primitive 65 write(float value, String name, float defVal)66 public void write(float value, String name, float defVal) throws IOException; write(float[] value, String name, float[] defVal)67 public void write(float[] value, String name, float[] defVal) throws IOException; write(float[][] value, String name, float[][] defVal)68 public void write(float[][] value, String name, float[][] defVal) throws IOException; 69 70 71 // double primitive 72 write(double value, String name, double defVal)73 public void write(double value, String name, double defVal) throws IOException; write(double[] value, String name, double[] defVal)74 public void write(double[] value, String name, double[] defVal) throws IOException; write(double[][] value, String name, double[][] defVal)75 public void write(double[][] value, String name, double[][] defVal) throws IOException; 76 77 78 // long primitive 79 write(long value, String name, long defVal)80 public void write(long value, String name, long defVal) throws IOException; write(long[] value, String name, long[] defVal)81 public void write(long[] value, String name, long[] defVal) throws IOException; write(long[][] value, String name, long[][] defVal)82 public void write(long[][] value, String name, long[][] defVal) throws IOException; 83 84 85 // short primitive 86 write(short value, String name, short defVal)87 public void write(short value, String name, short defVal) throws IOException; write(short[] value, String name, short[] defVal)88 public void write(short[] value, String name, short[] defVal) throws IOException; write(short[][] value, String name, short[][] defVal)89 public void write(short[][] value, String name, short[][] defVal) throws IOException; 90 91 92 // boolean primitive 93 write(boolean value, String name, boolean defVal)94 public void write(boolean value, String name, boolean defVal) throws IOException; write(boolean[] value, String name, boolean[] defVal)95 public void write(boolean[] value, String name, boolean[] defVal) throws IOException; write(boolean[][] value, String name, boolean[][] defVal)96 public void write(boolean[][] value, String name, boolean[][] defVal) throws IOException; 97 98 99 // String 100 write(String value, String name, String defVal)101 public void write(String value, String name, String defVal) throws IOException; write(String[] value, String name, String[] defVal)102 public void write(String[] value, String name, String[] defVal) throws IOException; write(String[][] value, String name, String[][] defVal)103 public void write(String[][] value, String name, String[][] defVal) throws IOException; 104 105 106 // BitSet 107 write(BitSet value, String name, BitSet defVal)108 public void write(BitSet value, String name, BitSet defVal) throws IOException; 109 110 111 // BinarySavable 112 write(Savable object, String name, Savable defVal)113 public void write(Savable object, String name, Savable defVal) throws IOException; write(Savable[] objects, String name, Savable[] defVal)114 public void write(Savable[] objects, String name, Savable[] defVal) throws IOException; write(Savable[][] objects, String name, Savable[][] defVal)115 public void write(Savable[][] objects, String name, Savable[][] defVal) throws IOException; 116 117 118 // ArrayLists 119 writeSavableArrayList(ArrayList array, String name, ArrayList defVal)120 public void writeSavableArrayList(ArrayList array, String name, ArrayList defVal) throws IOException; writeSavableArrayListArray(ArrayList[] array, String name, ArrayList[] defVal)121 public void writeSavableArrayListArray(ArrayList[] array, String name, ArrayList[] defVal) throws IOException; writeSavableArrayListArray2D(ArrayList[][] array, String name, ArrayList[][] defVal)122 public void writeSavableArrayListArray2D(ArrayList[][] array, String name, ArrayList[][] defVal) throws IOException; 123 writeFloatBufferArrayList(ArrayList<FloatBuffer> array, String name, ArrayList<FloatBuffer> defVal)124 public void writeFloatBufferArrayList(ArrayList<FloatBuffer> array, String name, ArrayList<FloatBuffer> defVal) throws IOException; writeByteBufferArrayList(ArrayList<ByteBuffer> array, String name, ArrayList<ByteBuffer> defVal)125 public void writeByteBufferArrayList(ArrayList<ByteBuffer> array, String name, ArrayList<ByteBuffer> defVal) throws IOException; 126 127 128 // Maps 129 writeSavableMap(Map<? extends Savable, ? extends Savable> map, String name, Map<? extends Savable, ? extends Savable> defVal)130 public void writeSavableMap(Map<? extends Savable, ? extends Savable> map, String name, Map<? extends Savable, ? extends Savable> defVal) throws IOException; writeStringSavableMap(Map<String, ? extends Savable> map, String name, Map<String, ? extends Savable> defVal)131 public void writeStringSavableMap(Map<String, ? extends Savable> map, String name, Map<String, ? extends Savable> defVal) throws IOException; writeIntSavableMap(IntMap<? extends Savable> map, String name, IntMap<? extends Savable> defVal)132 public void writeIntSavableMap(IntMap<? extends Savable> map, String name, IntMap<? extends Savable> defVal) throws IOException; 133 134 // NIO BUFFERS 135 // float buffer 136 write(FloatBuffer value, String name, FloatBuffer defVal)137 public void write(FloatBuffer value, String name, FloatBuffer defVal) throws IOException; 138 139 140 // int buffer 141 write(IntBuffer value, String name, IntBuffer defVal)142 public void write(IntBuffer value, String name, IntBuffer defVal) throws IOException; 143 144 145 // byte buffer 146 write(ByteBuffer value, String name, ByteBuffer defVal)147 public void write(ByteBuffer value, String name, ByteBuffer defVal) throws IOException; 148 149 150 // short buffer 151 write(ShortBuffer value, String name, ShortBuffer defVal)152 public void write(ShortBuffer value, String name, ShortBuffer defVal) throws IOException; 153 154 155 // enums 156 write(Enum value, String name, Enum defVal)157 public void write(Enum value, String name, Enum defVal) throws IOException; 158 }