public static Shape parseShape(java.io.InputStream in) {
if (in == null) return null;
Shape tempShape=null;
try{
// set the input stream
LEDataInputStream tempIn = new LEDataInputStream(in);
// read the endianness of the input stream
byte[] tempEndian = new byte[1];
int tempLength = in.read(tempEndian);
if (((int)tempEndian[0]) == 0)tempIn.setLittleEndianMode(false);
else tempIn.setLittleEndianMode(true);
// read the datatype of the incoming data
int tempType = tempIn.readInt();
// select the correct parsing routine
switch (tempType){
case 1: tempShape = parseWKBPoint(tempIn); break;
case 2: tempShape = parseWKBLineString(tempIn); break;