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