FreeWRL/FreeX3D  3.0.0
VFieldInputStream.java
1 // copyright (c) 1997,1998 stephen f. white
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2, or (at your option)
6 // any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; see the file COPYING. If not, write to
15 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
16 package vrml.external.FreeWRLEAI;
17 
18 import java.io.*;
19 
20 class VFieldInputStream extends DataInputStream {
21 
22  VFieldInputStream(InputStream in) {
23  super(in);
24  }
25 
26  VField readField() throws IOException {
27  byte type = readByte();
28  switch(type) {
29  case VField.NOTHING:
30  return null;
31  case VField.SFBOOL:
32  return new VSFBool(this);
33  case VField.SFVEC3F:
34  return new VSFVec3f(this);
35  case VField.SFROTATION:
36  return new VSFRotation(this);
37  case VField.SFSTRING:
38  return new VSFString(this);
39  case VField.MFSTRING:
40  return new VMFString(this);
41 
42 /*
43  case VField.SFCOLOR:
44  return new VSFColor(this);
45  case VField.SFFLOAT:
46  return new VSFFloat(this);
47  case VField.SFIMAGE:
48  return new VSFImage(this);
49  case VField.SFINT32:
50  return new VSFInt32(this);
51  case VField.SFTIME:
52  return new VSFTime(this);
53  case VField.SFVEC2F:
54  return new VSFVec2f(this);
55 
56  case VField.MFCOLOR:
57  return new VMFColor(this);
58  case VField.MFFLOAT:
59  return new VMFFloat(this);
60  case VField.MFINT32:
61  return new VMFInt32(this);
62  case VField.MFROTATION:
63  return new VMFRotation(this);
64  case VField.MFVEC2F:
65  return new VMFVec2f(this);
66  case VField.MFVEC3F:
67  return new VMFVec3f(this);
68 */
69 
70  default:
71  throw new UnsupportedFieldTypeException("type " + type);
72  }
73  }
74 }
75