static void insertString(String str, ByteBuffer buf) throws java.io.UnsupportedEncodingException { if (str != null && str.length() > 0) { buf.putInt(str.length() + 1); buf.put(str.getBytes("UTF-8"), 0, str.length()); buf.put((byte) 0); } else { // buffer is null or length 0 buf.putInt(0); } }
static void insertByteString(byte[] array, ByteBuffer buf) throws java.io.UnsupportedEncodingException { if (array != null && array.length > 0) { buf.putInt(array.length); buf.put(array, 0, array.length); buf.put((byte) 0); } else { // buffer is null or length 0 buf.putInt(0); } }
private void setRingCursor(ByteBuffer buffer, int newCursor) { checkArgument(newCursor >= 0); buffer.putInt(4, newCursor); }
static void insertByteArray(byte[] array, ByteBuffer buf) { if (array != null && array.length > 0) { buf.putInt(array.length); buf.put(array, 0, array.length); } else buf.putInt(0); }
// buf must be in little-endian byte order void write(ByteBuffer buf) { buf.putInt(MAGIC); buf.putInt(size); buf.putInt(flags); buf.putInt(height); buf.putInt(width); buf.putInt(pitchOrLinearSize); buf.putInt(backBufferCountOrDepth); buf.putInt(mipMapCountOrAux); buf.putInt(alphaBitDepth); buf.putInt(reserved1); buf.putInt(surface); buf.putInt(colorSpaceLowValue); buf.putInt(colorSpaceHighValue); buf.putInt(destBltColorSpaceLowValue); buf.putInt(destBltColorSpaceHighValue); buf.putInt(srcOverlayColorSpaceLowValue); buf.putInt(srcOverlayColorSpaceHighValue); buf.putInt(srcBltColorSpaceLowValue); buf.putInt(srcBltColorSpaceHighValue); buf.putInt(pfSize); buf.putInt(pfFlags); buf.putInt(pfFourCC); buf.putInt(pfRGBBitCount); buf.putInt(pfRBitMask); buf.putInt(pfGBitMask); buf.putInt(pfBBitMask); buf.putInt(pfABitMask); buf.putInt(ddsCaps1); buf.putInt(ddsCaps2); buf.putInt(ddsCapsReserved1); buf.putInt(ddsCapsReserved2); buf.putInt(textureStage); }