Package com.sun.j3d.internal

Source Code of com.sun.j3d.internal.ByteBufferWrapper

/*     */ package com.sun.j3d.internal;
/*     */
/*     */ import java.nio.Buffer;
/*     */ import java.nio.ByteBuffer;
/*     */ import java.nio.ByteOrder;
/*     */ import javax.media.j3d.J3DBuffer;
/*     */
/*     */ public class ByteBufferWrapper extends BufferWrapper
/*     */ {
/*  27 */   private ByteBuffer buffer = null;
/*     */
/*     */   public ByteBufferWrapper(ByteBuffer buffer)
/*     */   {
/*  34 */     this.buffer = buffer;
/*     */   }
/*     */
/*     */   public ByteBufferWrapper(J3DBuffer b)
/*     */   {
/*  42 */     this.buffer = ((ByteBuffer)b.getBuffer());
/*     */   }
/*     */
/*     */   public static ByteBufferWrapper allocateDirect(int capacity)
/*     */   {
/*  51 */     ByteBuffer bb = ByteBuffer.allocateDirect(capacity);
/*  52 */     return new ByteBufferWrapper(bb);
/*     */   }
/*     */
/*     */   public Buffer getBuffer()
/*     */   {
/*  60 */     return this.buffer;
/*     */   }
/*     */
/*     */   public boolean isDirect()
/*     */   {
/*  71 */     return this.buffer.isDirect();
/*     */   }
/*     */
/*     */   public byte get()
/*     */   {
/*  79 */     return this.buffer.get();
/*     */   }
/*     */
/*     */   public byte get(int index)
/*     */   {
/*  86 */     return this.buffer.get(index);
/*     */   }
/*     */
/*     */   public ByteBufferWrapper get(byte[] dst)
/*     */   {
/*  96 */     this.buffer.get(dst);
/*  97 */     return this;
/*     */   }
/*     */
/*     */   public ByteBufferWrapper get(byte[] dst, int offset, int length)
/*     */   {
/* 106 */     this.buffer.get(dst, offset, length);
/* 107 */     return this;
/*     */   }
/*     */
/*     */   public ByteOrderWrapper order()
/*     */   {
/* 114 */     if (this.buffer.order() == ByteOrder.BIG_ENDIAN) return ByteOrderWrapper.BIG_ENDIAN;
/* 115 */     return ByteOrderWrapper.LITTLE_ENDIAN;
/*     */   }
/*     */
/*     */   public ByteBufferWrapper order(ByteOrderWrapper bo)
/*     */   {
/* 123 */     if (bo == ByteOrderWrapper.BIG_ENDIAN) this.buffer.order(ByteOrder.BIG_ENDIAN); else
/* 124 */       this.buffer.order(ByteOrder.LITTLE_ENDIAN);
/* 125 */     return this;
/*     */   }
/*     */
/*     */   public FloatBufferWrapper asFloatBuffer()
/*     */   {
/* 133 */     return new FloatBufferWrapper(this.buffer.asFloatBuffer());
/*     */   }
/*     */
/*     */   public DoubleBufferWrapper asDoubleBuffer()
/*     */   {
/* 141 */     return new DoubleBufferWrapper(this.buffer.asDoubleBuffer());
/*     */   }
/*     */
/*     */   public ByteBufferWrapper put(byte[] src)
/*     */   {
/* 149 */     this.buffer.put(src);
/* 150 */     return this;
/*     */   }
/*     */
/*     */   public J3DBuffer getJ3DBuffer()
/*     */   {
/* 158 */     return new J3DBuffer(this.buffer);
/*     */   }
/*     */ }

/* Location:           Z:\System\Library\Java\Extensions\j3dutils.jar
* Qualified Name:     com.sun.j3d.internal.ByteBufferWrapper
* JD-Core Version:    0.6.2
*/
TOP

Related Classes of com.sun.j3d.internal.ByteBufferWrapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.