home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / ext / j3dutils.jar / com / sun / j3d / internal / BufferWrapper.class (.txt) next >
Encoding:
Java Class File  |  2002-06-19  |  1.3 KB  |  62 lines

  1. package com.sun.j3d.internal;
  2.  
  3. import java.nio.Buffer;
  4. import java.nio.ByteBuffer;
  5. import java.nio.DoubleBuffer;
  6. import java.nio.FloatBuffer;
  7. import javax.media.j3d.J3DBuffer;
  8.  
  9. public abstract class BufferWrapper {
  10.    public static final int TYPE_NULL = 0;
  11.    public static final int TYPE_UNKNOWN = 1;
  12.    public static final int TYPE_BYTE = 2;
  13.    public static final int TYPE_FLOAT = 3;
  14.    public static final int TYPE_DOUBLE = 4;
  15.  
  16.    abstract Buffer getBuffer();
  17.  
  18.    public Object getBufferAsObject() {
  19.       return this.getBuffer();
  20.    }
  21.  
  22.    public int capacity() {
  23.       return this.getBuffer().capacity();
  24.    }
  25.  
  26.    public int limit() {
  27.       return this.getBuffer().limit();
  28.    }
  29.  
  30.    public int position() {
  31.       return this.getBuffer().position();
  32.    }
  33.  
  34.    public BufferWrapper position(int var1) {
  35.       this.getBuffer().position(var1);
  36.       return this;
  37.    }
  38.  
  39.    public BufferWrapper rewind() {
  40.       this.getBuffer().rewind();
  41.       return this;
  42.    }
  43.  
  44.    public static int getBufferType(J3DBuffer var0) {
  45.       Buffer var2 = var0.getBuffer();
  46.       byte var1;
  47.       if (var2 == null) {
  48.          var1 = 0;
  49.       } else if (var2 instanceof ByteBuffer) {
  50.          var1 = 2;
  51.       } else if (var2 instanceof FloatBuffer) {
  52.          var1 = 3;
  53.       } else if (var2 instanceof DoubleBuffer) {
  54.          var1 = 4;
  55.       } else {
  56.          var1 = 1;
  57.       }
  58.  
  59.       return var1;
  60.    }
  61. }
  62.