Java 类java.nio.Buffer 实例源码

项目:googles-monorepo-demo    文件:ArbitraryInstancesTest.java   
public void testGet_io() throws IOException {
  assertEquals(-1, ArbitraryInstances.get(InputStream.class).read());
  assertEquals(-1, ArbitraryInstances.get(ByteArrayInputStream.class).read());
  assertEquals(-1, ArbitraryInstances.get(Readable.class).read(CharBuffer.allocate(1)));
  assertEquals(-1, ArbitraryInstances.get(Reader.class).read());
  assertEquals(-1, ArbitraryInstances.get(StringReader.class).read());
  assertEquals(0, ArbitraryInstances.get(Buffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(CharBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(ByteBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(ShortBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(IntBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(LongBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(FloatBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(DoubleBuffer.class).capacity());
  ArbitraryInstances.get(PrintStream.class).println("test");
  ArbitraryInstances.get(PrintWriter.class).println("test");
  assertNotNull(ArbitraryInstances.get(File.class));
  assertFreshInstanceReturned(
      ByteArrayOutputStream.class, OutputStream.class,
      Writer.class, StringWriter.class,
      PrintStream.class, PrintWriter.class);
  assertEquals(ByteSource.empty(), ArbitraryInstances.get(ByteSource.class));
  assertEquals(CharSource.empty(), ArbitraryInstances.get(CharSource.class));
  assertNotNull(ArbitraryInstances.get(ByteSink.class));
  assertNotNull(ArbitraryInstances.get(CharSink.class));
}
项目:Maxine-VM    文件:JniFunctions.java   
@VM_ENTRY_POINT
private static long GetDirectBufferCapacity(Pointer env, JniHandle buffer) {
    // Source: JniFunctionsSource.java:1766
    Pointer anchor = prologue(env);
    if (logger.enabled()) {
        logger.log(LogOperations.GetDirectBufferCapacity.ordinal(), UPCALL_ENTRY, anchor, env, buffer);
    }

    try {
        Object buf = buffer.unhand();
        if (DirectByteBuffer.isInstance(buf)) {
            return ((Buffer) buf).capacity();
        }
        return -1;
    } catch (Throwable t) {
        VmThread.fromJniEnv(env).setJniException(t);
        return JNI_ERR;
    } finally {
        epilogue(anchor);
        if (logger.enabled()) {
            logger.log(LogOperations.GetDirectBufferCapacity.ordinal(), UPCALL_EXIT);
        }

    }
}
项目:guava-mock    文件:ArbitraryInstancesTest.java   
public void testGet_io() throws IOException {
  assertEquals(-1, ArbitraryInstances.get(InputStream.class).read());
  assertEquals(-1, ArbitraryInstances.get(ByteArrayInputStream.class).read());
  assertEquals(-1, ArbitraryInstances.get(Readable.class).read(CharBuffer.allocate(1)));
  assertEquals(-1, ArbitraryInstances.get(Reader.class).read());
  assertEquals(-1, ArbitraryInstances.get(StringReader.class).read());
  assertEquals(0, ArbitraryInstances.get(Buffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(CharBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(ByteBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(ShortBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(IntBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(LongBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(FloatBuffer.class).capacity());
  assertEquals(0, ArbitraryInstances.get(DoubleBuffer.class).capacity());
  ArbitraryInstances.get(PrintStream.class).println("test");
  ArbitraryInstances.get(PrintWriter.class).println("test");
  assertNotNull(ArbitraryInstances.get(File.class));
  assertFreshInstanceReturned(
      ByteArrayOutputStream.class, OutputStream.class,
      Writer.class, StringWriter.class,
      PrintStream.class, PrintWriter.class);
  assertEquals(ByteSource.empty(), ArbitraryInstances.get(ByteSource.class));
  assertEquals(CharSource.empty(), ArbitraryInstances.get(CharSource.class));
  assertNotNull(ArbitraryInstances.get(ByteSink.class));
  assertNotNull(ArbitraryInstances.get(CharSink.class));
}
项目:Fatigue-Detection    文件:OpenGlUtils.java   
public static int loadTexture(Buffer paramBuffer, int paramInt1, int paramInt2, int paramInt3)
{
    int[] arrayOfInt = new int[1];
    if (paramInt3 == -1)
    {
        GLES20.glGenTextures(1, arrayOfInt, 0);
        GLES20.glBindTexture(3553, arrayOfInt[0]);
        GLES20.glTexParameterf(3553, 10240, 9729.0F);

        GLES20.glTexParameterf(3553, 10241, 9729.0F);

        GLES20.glTexParameterf(3553, 10242, 33071.0F);

        GLES20.glTexParameterf(3553, 10243, 33071.0F);

        GLES20.glTexImage2D(3553, 0, 6408, paramInt1, paramInt2, 0, 6408, 5121, paramBuffer);
    }
    else
    {
        GLES20.glBindTexture(3553, paramInt3);
        GLES20.glTexSubImage2D(3553, 0, 0, 0, paramInt1, paramInt2, 6408, 5121, paramBuffer);

        arrayOfInt[0] = paramInt3;
    }
    return arrayOfInt[0];
}
项目:PaoMovie    文件:OpenGLUtils.java   
public static int loadTexture(final Buffer data, final int width,final int height, final int usedTexId) {
if(data == null)
    return NO_TEXTURE;
   int textures[] = new int[1];
   if (usedTexId == NO_TEXTURE) {
       GLES20.glGenTextures(1, textures, 0);
       GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
       GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height,
               0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
   } else {
       GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
       GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,
               height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, data);
       textures[0] = usedTexId;
   }
   return textures[0];
  }
项目:PaoMovie    文件:OpenGLUtils.java   
public static int loadTexture(final Buffer data, final int width,final int height, final int usedTexId,final int type) {
if(data == null)
    return NO_TEXTURE;
   int textures[] = new int[1];
   if (usedTexId == NO_TEXTURE) {
       GLES20.glGenTextures(1, textures, 0);
       GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
       GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
               GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
       GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height,
               0, GLES20.GL_RGBA, type, data);
   } else {
       GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
       GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,
               height, GLES20.GL_RGBA, type, data);
       textures[0] = usedTexId;
   }
   return textures[0];
  }
项目:debug    文件:EXTDirectStateAccess.java   
private static void glTextureImage3DEXT_trace(int texture, int target, int level, int internalformat, int width, int height, int depth, int border, int format, int type, Buffer pixels,
        MethodCall mc) {
    mc.param(texture);
    mc.paramEnum(GLmetadata.TextureTarget().get(target));
    mc.param(level);
    if (internalformat >= 1 && internalformat <= 4)
        mc.param(internalformat);
    else
        mc.paramEnum(GLmetadata.InternalFormat().get(internalformat));
    mc.param(width);
    mc.param(height);
    mc.param(depth);
    mc.param(border);
    mc.paramEnum(GLmetadata.PixelFormat().get(format));
    mc.paramEnum(GLmetadata.PixelType().get(type));
    mc.param(pixels);
}
项目:Ultraino    文件:BufferUtils.java   
private static boolean isDirect(Buffer buf) {
    if (buf instanceof FloatBuffer) {
        return ((FloatBuffer) buf).isDirect();
    }
    if (buf instanceof IntBuffer) {
        return ((IntBuffer) buf).isDirect();
    }
    if (buf instanceof ShortBuffer) {
        return ((ShortBuffer) buf).isDirect();
    }
    if (buf instanceof ByteBuffer) {
        return ((ByteBuffer) buf).isDirect();
    }
    if (buf instanceof DoubleBuffer) {
        return ((DoubleBuffer) buf).isDirect();
    }
    if (buf instanceof LongBuffer) {
        return ((LongBuffer) buf).isDirect();
    }
    throw new UnsupportedOperationException(" BufferAux.isDirect was called on " + buf.getClass().getName());
}
项目:FilterPlayer    文件:OpenGlUtils.java   
public static int loadTexture(final Buffer data, final int width,final int height, final int usedTexId,final int type) {
    if(data == null)
        return NO_TEXTURE;
    int textures[] = new int[1];
    if (usedTexId == NO_TEXTURE) {
        GLES20.glGenTextures(1, textures, 0);
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textures[0]);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
                GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
        GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height,
                0, GLES20.GL_RGBA, type, data);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, usedTexId);
        GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, width,
                height, GLES20.GL_RGBA, type, data);
        textures[0] = usedTexId;
    }
    return textures[0];
}
项目:Ultraino    文件:BufferUtils.java   
/**
 * Creates a clone of the given buffer. The clone's capacity is 
 * equal to the given buffer's limit.
 * 
 * @param buf The buffer to clone
 * @return The cloned buffer
 */
public static Buffer clone(Buffer buf) {
    if (buf instanceof FloatBuffer) {
        return clone((FloatBuffer) buf);
    } else if (buf instanceof ShortBuffer) {
        return clone((ShortBuffer) buf);
    } else if (buf instanceof ByteBuffer) {
        return clone((ByteBuffer) buf);
    } else if (buf instanceof IntBuffer) {
        return clone((IntBuffer) buf);
    } else if (buf instanceof DoubleBuffer) {
        return clone((DoubleBuffer) buf);
    } else {
        throw new UnsupportedOperationException();
    }
}
项目:openjdk-jdk10    文件:SingleByte.java   
private static final CoderResult withResult(CoderResult cr,
                                            Buffer src, int sp,
                                            Buffer dst, int dp)
{
    src.position(sp - src.arrayOffset());
    dst.position(dp - dst.arrayOffset());
    return cr;
}
项目:hadoop-oss    文件:ZlibDecompressor.java   
int inflateDirect(ByteBuffer src, ByteBuffer dst) throws IOException {
  assert (this instanceof ZlibDirectDecompressor);

  ByteBuffer presliced = dst;
  if (dst.position() > 0) {
    presliced = dst;
    dst = dst.slice();
  }

  Buffer originalCompressed = compressedDirectBuf;
  Buffer originalUncompressed = uncompressedDirectBuf;
  int originalBufferSize = directBufferSize;
  compressedDirectBuf = src;
  compressedDirectBufOff = src.position();
  compressedDirectBufLen = src.remaining();
  uncompressedDirectBuf = dst;
  directBufferSize = dst.remaining();
  int n = 0;
  try {
    n = inflateBytesDirect();
    presliced.position(presliced.position() + n);
    if (compressedDirectBufLen > 0) {
      src.position(compressedDirectBufOff);
    } else {
      src.position(src.limit());
    }
  } finally {
    compressedDirectBuf = originalCompressed;
    uncompressedDirectBuf = originalUncompressed;
    compressedDirectBufOff = 0;
    compressedDirectBufLen = 0;
    directBufferSize = originalBufferSize;
  }
  return n;
}
项目:TriMeshKit    文件:TriMesh.java   
public Buffer getFacesIndices()
  {
if(mDirty)
{
    mFacesIndices = BufferUtility.getIntBuffer(getInternalFacesIndices());
    mDirty = false;
}
return mFacesIndices;
  }
项目:ftljson    文件:Unsafe.java   
private static long findBufferAddress() {
    try {
        return UNSAFE.objectFieldOffset(getDeclaredField(Buffer.class, "address"));
    } catch (Exception e) {
        throw new UnsupportedOperationException("Could not detect ByteBuffer.address offset", e);
    }
}
项目:guava-mock    文件:FreshValueGeneratorTest.java   
@AndroidIncompatible // problem with equality of Type objects?
public void testFreshInstance() {
  assertFreshInstances(
      String.class, CharSequence.class,
      Appendable.class, StringBuffer.class, StringBuilder.class,
      Pattern.class, MatchResult.class,
      Number.class, int.class, Integer.class,
      long.class, Long.class,
      short.class, Short.class,
      byte.class, Byte.class,
      boolean.class, Boolean.class,
      char.class, Character.class,
      int[].class, Object[].class,
      UnsignedInteger.class, UnsignedLong.class,
      BigInteger.class, BigDecimal.class,
      Throwable.class, Error.class, Exception.class, RuntimeException.class,
      Charset.class, Locale.class, Currency.class,
      List.class, Map.Entry.class,
      Object.class,
      Equivalence.class, Predicate.class, Function.class,
      Comparable.class, Comparator.class, Ordering.class,
      Class.class, Type.class, TypeToken.class,
      TimeUnit.class, Ticker.class,
      Joiner.class, Splitter.class, CharMatcher.class,
      InputStream.class, ByteArrayInputStream.class,
      Reader.class, Readable.class, StringReader.class,
      OutputStream.class, ByteArrayOutputStream.class,
      Writer.class, StringWriter.class, File.class,
      Buffer.class, ByteBuffer.class, CharBuffer.class,
      ShortBuffer.class, IntBuffer.class, LongBuffer.class,
      FloatBuffer.class, DoubleBuffer.class,
      String[].class, Object[].class, int[].class);
}
项目:jdk8u-jdk    文件:Basic.java   
static String toString(Buffer b) {
    return (b.getClass().getName()
            + "[pos=" + b.position()
            + " lim=" + b.limit()
            + " cap=" + b.capacity()
            + "]");
}
项目:TriMeshKit    文件:TriMesh.java   
public Buffer getVerticesPoints()
  {
if(mDirty)
{
    mPositions = BufferUtility.getFloatBuffer(getInternalVerticesPoints());
}

return mPositions;
  }
项目:debug    文件:RT.java   
public static boolean checkNativeByteOrder(Buffer buf) {
    if (buf == null) {
        return true;
    }
    throwIfNotNativeEndianness(bufferEndiannessWritten.get(buf));
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        throwIfNotNativeEndianness(bufferEndiannessWritten.get(viewedBuffer));
    }
    return true;
}
项目:debug    文件:RT.java   
private static void writeByteBuffer(ByteBuffer buf) {
    ByteOrder order = bufferEndiannessWritten.get(buf);
    if (order == null) {
        Buffer viewedBuffer = bufferViews.get(buf);
        if (viewedBuffer != null) {
            bufferEndiannessWritten.put(viewedBuffer, buf.order());
        } else {
            bufferEndiannessWritten.put(buf, buf.order());
        }
    }
}
项目:debug    文件:RT.java   
private static void writeShortBuffer(ShortBuffer buf) {
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferEndiannessWritten.put(viewedBuffer, buf.order());
    } else {
        /* We don't know how that typed view was created. Just assume it is correct. */
    }
}
项目:openjdk-jdk10    文件:ByteBufferTest.java   
Buffer asView(ByteBuffer b, PrimitiveType t) {
    switch (t) {
        case BYTE: return b;
        case CHAR: return b.asCharBuffer();
        case SHORT: return b.asShortBuffer();
        case INT: return b.asIntBuffer();
        case LONG: return b.asLongBuffer();
        case FLOAT: return b.asFloatBuffer();
        case DOUBLE: return b.asDoubleBuffer();
    }
    throw new InternalError("Should not reach here");
}
项目:debug    文件:RT.java   
private static void writeDoubleBuffer(DoubleBuffer buf) {
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferEndiannessWritten.put(viewedBuffer, buf.order());
    } else {
        throw new AssertionError();
    }
}
项目:bloom    文件:Platform.java   
public static long getByteBufferAddress(ByteBuffer buffer) {
  try {
    return getField(Buffer.class, "address").getLong(buffer);
  } catch (IllegalAccessException e) {
    throw new IllegalStateException(e);
  }
}
项目:debug    文件:RT.java   
public static IntBuffer slice(IntBuffer buf) {
    IntBuffer buffer = buf.slice();
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferViews.put(buffer, viewedBuffer);
    }
    return buffer;
}
项目:debug    文件:RT.java   
public static LongBuffer slice(LongBuffer buf) {
    LongBuffer buffer = buf.slice();
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferViews.put(buffer, viewedBuffer);
    }
    return buffer;
}
项目:openjdk-jdk10    文件:ByteBufferTest.java   
void asViewGetOne(Buffer v, PrimitiveType t, int index) {
    switch (t) {
        case BYTE: ((ByteBuffer) v).get(index); break;
        case CHAR: ((CharBuffer) v).get(index); break;
        case SHORT: ((ShortBuffer) v).get(index); break;
        case INT: ((IntBuffer) v).get(index); break;
        case LONG: ((LongBuffer) v).get(index); break;
        case FLOAT: ((FloatBuffer) v).get(index); break;
        case DOUBLE: ((DoubleBuffer) v).get(index); break;
    }
}
项目:debug    文件:RT.java   
public static ShortBuffer asShortBuffer(ByteBuffer buf) {
    ShortBuffer buffer = buf.asShortBuffer();
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferViews.put(buffer, viewedBuffer);
    } else {
        bufferViews.put(buffer, buf);
    }
    return buffer;
}
项目:debug    文件:RT.java   
public static IntBuffer asIntBuffer(ByteBuffer buf) {
    IntBuffer buffer = buf.asIntBuffer();
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferViews.put(buffer, viewedBuffer);
    } else {
        bufferViews.put(buffer, buf);
    }
    return buffer;
}
项目:debug    文件:RT.java   
public static LongBuffer asLongBuffer(ByteBuffer buf) {
    LongBuffer buffer = buf.asLongBuffer();
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferViews.put(buffer, viewedBuffer);
    } else {
        bufferViews.put(buffer, buf);
    }
    return buffer;
}
项目:debug    文件:RT.java   
public static FloatBuffer asFloatBuffer(ByteBuffer buf) {
    FloatBuffer buffer = buf.asFloatBuffer();
    Buffer viewedBuffer = bufferViews.get(buf);
    if (viewedBuffer != null) {
        bufferViews.put(buffer, viewedBuffer);
    } else {
        bufferViews.put(buffer, buf);
    }
    return buffer;
}
项目:debug    文件:RT.java   
private static void checkBufferDirect(Buffer buffer, String type) {
    if (buffer == null) {
        return;
    }
    if (!buffer.isDirect()) {
        throwIAEOrLogError("buffer is not direct. Buffers created via " + type + ".allocate() or " + type + ".wrap() are not supported. " + "Use BufferUtils.create" + type + "() instead.");
    } else if (buffer.remaining() == 0) {
        throwIAEOrLogError("buffer has no remaining elements. Did you forget to flip()/rewind() it?");
    }
}
项目:debug    文件:GL11.java   
private static void glTexImage1D_trace(int target, int level, int internalformat, int width, int border, int format, int type, Buffer pixels, MethodCall mc) {
    mc.paramEnum(GLmetadata.TextureTarget().get(target));
    mc.param(level);
    if (internalformat >= 1 && internalformat <= 4)
        mc.param(internalformat);
    else
        mc.paramEnum(RT.glEnumFor(internalformat, GLmetadata.InternalFormat()));
    mc.param(width);
    mc.param(border);
    mc.paramEnum(RT.glEnumFor(format, GLmetadata.PixelFormat()));
    mc.paramEnum(RT.glEnumFor(type, GLmetadata.PixelType()));
    mc.param(pixels);
}
项目:debug    文件:EXTDirectStateAccess.java   
private static void glMultiTexImage1DEXT_trace(int texunit, int target, int level, int internalformat, int width, int border, int format, int type, Buffer pixels, MethodCall mc) {
    mc.paramEnum(GLmetadata._null_().get(texunit));
    mc.paramEnum(GLmetadata.TextureTarget().get(target));
    mc.param(level);
    if (internalformat >= 1 && internalformat <= 4)
        mc.param(internalformat);
    else
        mc.paramEnum(GLmetadata.InternalFormat().get(internalformat));
    mc.param(width);
    mc.param(border);
    mc.paramEnum(GLmetadata.PixelFormat().get(format));
    mc.paramEnum(GLmetadata.PixelType().get(type));
    mc.param(pixels);
}
项目:debug    文件:EXTDirectStateAccess.java   
private static void glTextureImage1DEXT_trace(int texture, int target, int level, int internalformat, int width, int border, int format, int type, Buffer pixels, MethodCall mc) {
    mc.param(texture);
    mc.paramEnum(GLmetadata.TextureTarget().get(target));
    mc.param(level);
    if (internalformat >= 1 && internalformat <= 4)
        mc.param(internalformat);
    else
        mc.paramEnum(GLmetadata.InternalFormat().get(internalformat));
    mc.param(width);
    mc.param(border);
    mc.paramEnum(GLmetadata.PixelFormat().get(format));
    mc.paramEnum(GLmetadata.PixelType().get(type));
    mc.param(pixels);
}
项目:debug    文件:EXTDirectStateAccess.java   
private static void glTextureImage2DEXT_trace(int texture, int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels, MethodCall mc) {
    mc.param(texture);
    mc.paramEnum(GLmetadata.TextureTarget().get(target));
    mc.param(level);
    if (internalformat >= 1 && internalformat <= 4)
        mc.param(internalformat);
    else
        mc.paramEnum(GLmetadata.InternalFormat().get(internalformat));
    mc.param(width);
    mc.param(height);
    mc.param(border);
    mc.paramEnum(GLmetadata.PixelFormat().get(format));
    mc.paramEnum(GLmetadata.PixelType().get(type));
    mc.param(pixels);
}
项目:VideoRecorder-master    文件:FFmpegRecorderActivity.java   
/**
 * shortBuffer包含了音频的数据和起始位置
 *
 * @param shortBuffer
 */
private void record(ShortBuffer shortBuffer) {
    try {
        if (videoRecorder != null) {
            this.mCount += shortBuffer.limit();
            videoRecorder.record(0, new Buffer[]{shortBuffer});
        }
    } catch (FrameRecorder.Exception localException) {

    }
    return;
}
项目:Ultraino    文件:BufferUtils.java   
@Override
public void run() {
    try {
        while (true) {
            Reference<? extends Buffer> toclean = BufferUtils.removeCollected.remove();
            BufferUtils.trackedBuffers.remove(toclean);
        }

    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
项目:accelerator-core-android    文件:ScreenSharingCapturer.java   
@Override
public void onImageAvailable(ImageReader reader) {
        Image mImage = null;
        FileOutputStream fos = null;

        try {
            mImage = mImageReader.acquireLatestImage();

            if (mImage != null) {
                int imgWidth = mImage.getWidth();
                int imgHeight = mImage.getHeight();

                Image.Plane[] planes = mImage.getPlanes();
                ByteBuffer buffer = planes[0].getBuffer();
                int pixelStride = planes[0].getPixelStride();
                int rowStride = planes[0].getRowStride();
                int rowPadding = rowStride - pixelStride * imgWidth;

                Buffer buffer2 = planes[0].getBuffer().rewind();
                bmp = Bitmap.createBitmap(imgWidth + rowPadding / pixelStride, imgHeight, Bitmap.Config.ARGB_8888);

                bmp.copyPixelsFromBuffer(buffer2);
                lastBmp = bmp.copy(bmp.getConfig(), true);
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (bmp != null) {
                bmp.recycle();
            }

            if (mImage != null) {
                mImage.close();
            }
        }
}
项目:FlickLauncher    文件:GLES20Canvas.java   
private int uploadBuffer(Buffer buffer, int elementSize) {
    mGLId.glGenBuffers(1, mTempIntArray, 0);
    checkError();
    int bufferId = mTempIntArray[0];
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, bufferId);
    checkError();
    GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, buffer.capacity() * elementSize, buffer,
            GLES20.GL_STATIC_DRAW);
    checkError();
    return bufferId;
}
项目:jdk8u-jdk    文件:CESU_8.java   
private static final void updatePositions(Buffer src, int sp,
                                          Buffer dst, int dp) {
    src.position(sp - src.arrayOffset());
    dst.position(dp - dst.arrayOffset());
}