<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_26) on Sun Jan 27 20:37:08 CET 2013 -->
<TITLE>
BufferUtils (libgdx API)
</TITLE>
<META NAME="date" CONTENT="2013-01-27">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BufferUtils (libgdx API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package
</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class
</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/BufferUtils.html"><FONT CLASS="NavBarFont1"><B>Use
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help
</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
libgdx API
<style>
body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%; font-weight:bold }
.TableHeadingColor { background:#EEEEFF; }
a { text-decoration:none }
a:hover { text-decoration:underline }
a:link, a:visited { color:blue }
table { border:0px }
.TableRowColor td:first-child { border-left:1px solid black }
.TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
hr { border:0px; border-bottom:1px solid #333366; }
</style>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/badlogic/gdx/utils/BooleanArray.html" title="class in com.badlogic.gdx.utils"><B>PREV CLASS
</B></A>
<A HREF="../../../../com/badlogic/gdx/utils/CharArray.html" title="class in com.badlogic.gdx.utils"><B>NEXT CLASS
</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/badlogic/gdx/utils/BufferUtils.html" target="_top"><B>FRAMES
</B></A>
<A HREF="BufferUtils.html" target="_top"><B>NO FRAMES
</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes
</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:
NESTED
|
FIELD
|
<A HREF="#constructor_summary">CONSTR
</A> |
<A HREF="#method_summary">METHOD
</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:
FIELD
|
<A HREF="#constructor_detail">CONSTR
</A> |
<A HREF="#method_detail">METHOD
</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.badlogic.gdx.utils
</FONT>
<BR>
Class BufferUtils
</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.badlogic.gdx.utils.BufferUtils
</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class
<B>BufferUtils
</B><DT>extends java.lang.Object
</DL>
</PRE>
<P>
Class with static helper methods to increase the speed of array/direct buffer and direct buffer/direct buffer transfers
<P>
<P>
<DL>
<DT><B>Author:
</B></DT>
<DD>mzechner
</DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary
</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#BufferUtils()">BufferUtils
</A></B>()
</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary
</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#clear(java.nio.ByteBuffer, int)">clear
</A></B>(java.nio.ByteBuffer
buffer,
int
numBytes)
</CODE>
<BR>
Writes the specified number of zeros to the buffer.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(java.nio.Buffer, java.nio.Buffer, int)">copy
</A></B>(java.nio.Buffer
src,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from the current position of src, copying numElements elements (using the data
type of src, no matter the datatype of dst).
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(byte[], int, java.nio.Buffer, int)">copy
</A></B>(byte[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(char[], int, java.nio.Buffer, int)">copy
</A></B>(char[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(double[], int, java.nio.Buffer, int)">copy
</A></B>(double[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(float[], java.nio.Buffer, int, int)">copy
</A></B>(float[]
src,
java.nio.Buffer
dst,
int
numFloats,
int
offset)
</CODE>
<BR>
Copies numFloats floats from src starting at offset to dst.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(float[], int, java.nio.Buffer, int)">copy
</A></B>(float[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(int[], int, java.nio.Buffer, int)">copy
</A></B>(int[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(long[], int, java.nio.Buffer, int)">copy
</A></B>(long[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#copy(short[], int, java.nio.Buffer, int)">copy
</A></B>(short[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</CODE>
<BR>
Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
void
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#disposeUnsafeByteBuffer(java.nio.ByteBuffer)">disposeUnsafeByteBuffer
</A></B>(java.nio.ByteBuffer
buffer)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
int
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#getAllocatedBytesUnsafe()">getAllocatedBytesUnsafe
</A></B>()
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
long
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#getUnsafeBufferAddress(java.nio.Buffer)">getUnsafeBufferAddress
</A></B>(java.nio.Buffer
buffer)
</CODE>
<BR>
Returns the address of the Buffer, it assumes it is an unsafe buffer.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.ByteBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newByteBuffer(int)">newByteBuffer
</A></B>(int
numBytes)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.CharBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newCharBuffer(int)">newCharBuffer
</A></B>(int
numChars)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.DoubleBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newDoubleBuffer(int)">newDoubleBuffer
</A></B>(int
numDoubles)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.FloatBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newFloatBuffer(int)">newFloatBuffer
</A></B>(int
numFloats)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.IntBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newIntBuffer(int)">newIntBuffer
</A></B>(int
numInts)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.LongBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newLongBuffer(int)">newLongBuffer
</A></B>(int
numLongs)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.ShortBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newShortBuffer(int)">newShortBuffer
</A></B>(int
numShorts)
</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.ByteBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newUnsafeByteBuffer(java.nio.ByteBuffer)">newUnsafeByteBuffer
</A></B>(java.nio.ByteBuffer
buffer)
</CODE>
<BR>
Registers the given ByteBuffer as an unsafe ByteBuffer.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
java.nio.ByteBuffer
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newUnsafeByteBuffer(int)">newUnsafeByteBuffer
</A></B>(int
numBytes)
</CODE>
<BR>
Allocates a new direct ByteBuffer from native heap memory using the native byte order.
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object
</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail
</B></FONT></TH>
</TR>
</TABLE>
<A NAME="BufferUtils()"><!-- --></A><H3>
BufferUtils
</H3>
<PRE>
public
<B>BufferUtils
</B>()
</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail
</B></FONT></TH>
</TR>
</TABLE>
<A NAME="copy(float[], java.nio.Buffer, int, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(float[]
src,
java.nio.Buffer
dst,
int
numFloats,
int
offset)
</PRE>
<DL>
<DD>Copies numFloats floats from src starting at offset to dst. Dst is assumed to be a direct
<CODE>Buffer
</CODE>. The method will
crash if that is not the case. The position and limit of the buffer are ignored, the copy is placed at position 0 in the
buffer. After the copying process the position of the buffer is set to 0 and its limit is set to numFloats * 4 if it is a
ByteBuffer and numFloats if it is a FloatBuffer. In case the Buffer is neither a ByteBuffer nor a FloatBuffer the limit is
not set. This is an expert method, use at your own risk.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array
<DD><CODE>dst
</CODE> - the destination buffer, has to be a direct Buffer
<DD><CODE>numFloats
</CODE> - the number of floats to copy
<DD><CODE>offset
</CODE> - the offset in src to start copying from
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(byte[], int, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(byte[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The
<CODE>Buffer
</CODE> instance's
<CODE>Buffer.position()
</CODE> is used to define the offset into the Buffer itself. The position will stay the same, the limit
will be set to position + numElements.
<b>The Buffer must be a direct Buffer with native byte order. No error checking is
performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array.
<DD><CODE>srcOffset
</CODE> - the offset into the source array.
<DD><CODE>dst
</CODE> - the destination Buffer, its position is used as an offset.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(short[], int, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(short[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The
<CODE>Buffer
</CODE> instance's
<CODE>Buffer.position()
</CODE> is used to define the offset into the Buffer itself. The position will stay the same, the limit
will be set to position + numElements.
<b>The Buffer must be a direct Buffer with native byte order. No error checking is
performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array.
<DD><CODE>srcOffset
</CODE> - the offset into the source array.
<DD><CODE>dst
</CODE> - the destination Buffer, its position is used as an offset.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(char[], int, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(char[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The
<CODE>Buffer
</CODE> instance's
<CODE>Buffer.position()
</CODE> is used to define the offset into the Buffer itself. The position will stay the same, the limit
will be set to position + numElements.
<b>The Buffer must be a direct Buffer with native byte order. No error checking is
performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array.
<DD><CODE>srcOffset
</CODE> - the offset into the source array.
<DD><CODE>dst
</CODE> - the destination Buffer, its position is used as an offset.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(int[], int, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(int[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The
<CODE>Buffer
</CODE> instance's
<CODE>Buffer.position()
</CODE> is used to define the offset into the Buffer itself. The position will stay the same, the limit
will be set to position + numElements.
<b>The Buffer must be a direct Buffer with native byte order. No error checking is
performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array.
<DD><CODE>srcOffset
</CODE> - the offset into the source array.
<DD><CODE>dst
</CODE> - the destination Buffer, its position is used as an offset.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(long[], int, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(long[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The
<CODE>Buffer
</CODE> instance's
<CODE>Buffer.position()
</CODE> is used to define the offset into the Buffer itself. The position will stay the same, the limit
will be set to position + numElements.
<b>The Buffer must be a direct Buffer with native byte order. No error checking is
performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array.
<DD><CODE>srcOffset
</CODE> - the offset into the source array.
<DD><CODE>dst
</CODE> - the destination Buffer, its position is used as an offset.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(float[], int, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(float[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The
<CODE>Buffer
</CODE> instance's
<CODE>Buffer.position()
</CODE> is used to define the offset into the Buffer itself. The position will stay the same, the limit
will be set to position + numElements.
<b>The Buffer must be a direct Buffer with native byte order. No error checking is
performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array.
<DD><CODE>srcOffset
</CODE> - the offset into the source array.
<DD><CODE>dst
</CODE> - the destination Buffer, its position is used as an offset.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(double[], int, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(double[]
src,
int
srcOffset,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from src[srcOffset], copying numElements elements. The
<CODE>Buffer
</CODE> instance's
<CODE>Buffer.position()
</CODE> is used to define the offset into the Buffer itself. The position will stay the same, the limit
will be set to position + numElements.
<b>The Buffer must be a direct Buffer with native byte order. No error checking is
performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source array.
<DD><CODE>srcOffset
</CODE> - the offset into the source array.
<DD><CODE>dst
</CODE> - the destination Buffer, its position is used as an offset.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="copy(java.nio.Buffer, java.nio.Buffer, int)"><!-- --></A><H3>
copy
</H3>
<PRE>
public static void
<B>copy
</B>(java.nio.Buffer
src,
java.nio.Buffer
dst,
int
numElements)
</PRE>
<DL>
<DD>Copies the contents of src to dst, starting from the current position of src, copying numElements elements (using the data
type of src, no matter the datatype of dst). The dst
<CODE>Buffer.position()
</CODE> is used as the writing offset. The position
of both Buffers will stay the same. The limit of the src Buffer will stay the same. The limit of the dst Buffer will be set
to dst.position() + numElements, where numElements are translated to the number of elements appropriate for the dst Buffer
data type.
<b>The Buffers must be direct Buffers with native byte order. No error checking is performed
</b>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>src
</CODE> - the source Buffer.
<DD><CODE>dst
</CODE> - the destination Buffer.
<DD><CODE>numElements
</CODE> - the number of elements to copy.
</DL>
</DD>
</DL>
<HR>
<A NAME="newFloatBuffer(int)"><!-- --></A><H3>
newFloatBuffer
</H3>
<PRE>
public static java.nio.FloatBuffer
<B>newFloatBuffer
</B>(int
numFloats)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newDoubleBuffer(int)"><!-- --></A><H3>
newDoubleBuffer
</H3>
<PRE>
public static java.nio.DoubleBuffer
<B>newDoubleBuffer
</B>(int
numDoubles)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newByteBuffer(int)"><!-- --></A><H3>
newByteBuffer
</H3>
<PRE>
public static java.nio.ByteBuffer
<B>newByteBuffer
</B>(int
numBytes)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newShortBuffer(int)"><!-- --></A><H3>
newShortBuffer
</H3>
<PRE>
public static java.nio.ShortBuffer
<B>newShortBuffer
</B>(int
numShorts)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newCharBuffer(int)"><!-- --></A><H3>
newCharBuffer
</H3>
<PRE>
public static java.nio.CharBuffer
<B>newCharBuffer
</B>(int
numChars)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newIntBuffer(int)"><!-- --></A><H3>
newIntBuffer
</H3>
<PRE>
public static java.nio.IntBuffer
<B>newIntBuffer
</B>(int
numInts)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newLongBuffer(int)"><!-- --></A><H3>
newLongBuffer
</H3>
<PRE>
public static java.nio.LongBuffer
<B>newLongBuffer
</B>(int
numLongs)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="disposeUnsafeByteBuffer(java.nio.ByteBuffer)"><!-- --></A><H3>
disposeUnsafeByteBuffer
</H3>
<PRE>
public static void
<B>disposeUnsafeByteBuffer
</B>(java.nio.ByteBuffer
buffer)
</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newUnsafeByteBuffer(int)"><!-- --></A><H3>
newUnsafeByteBuffer
</H3>
<PRE>
public static java.nio.ByteBuffer
<B>newUnsafeByteBuffer
</B>(int
numBytes)
</PRE>
<DL>
<DD>Allocates a new direct ByteBuffer from native heap memory using the native byte order. Needs to be disposed with
<A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#freeMemory(java.nio.ByteBuffer)"><CODE>freeMemory(ByteBuffer)
</CODE></A>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>numBytes
</CODE> -
</DL>
</DD>
</DL>
<HR>
<A NAME="getUnsafeBufferAddress(java.nio.Buffer)"><!-- --></A><H3>
getUnsafeBufferAddress
</H3>
<PRE>
public static long
<B>getUnsafeBufferAddress
</B>(java.nio.Buffer
buffer)
</PRE>
<DL>
<DD>Returns the address of the Buffer, it assumes it is an unsafe buffer.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>buffer
</CODE> - The Buffer to ask the address for.
<DT><B>Returns:
</B><DD>the address of the Buffer.
</DL>
</DD>
</DL>
<HR>
<A NAME="newUnsafeByteBuffer(java.nio.ByteBuffer)"><!-- --></A><H3>
newUnsafeByteBuffer
</H3>
<PRE>
public static java.nio.ByteBuffer
<B>newUnsafeByteBuffer
</B>(java.nio.ByteBuffer
buffer)
</PRE>
<DL>
<DD>Registers the given ByteBuffer as an unsafe ByteBuffer. The ByteBuffer must have been
allocated in native code, pointing to a memory region allocated via malloc. Needs to
be disposed with
<A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#freeMemory(java.nio.ByteBuffer)"><CODE>freeMemory(ByteBuffer)
</CODE></A>.
<P>
<DD><DL>
<DT><B>Parameters:
</B><DD><CODE>buffer
</CODE> - the
<CODE>ByteBuffer
</CODE> to register
<DT><B>Returns:
</B><DD>the ByteBuffer passed to the method
</DL>
</DD>
</DL>
<HR>
<A NAME="getAllocatedBytesUnsafe()"><!-- --></A><H3>
getAllocatedBytesUnsafe
</H3>
<PRE>
public static int
<B>getAllocatedBytesUnsafe
</B>()
</PRE>
<DL>
<DD><DL>
<DT><B>Returns:
</B><DD>the number of bytes allocated with
<A HREF="../../../../com/badlogic/gdx/utils/BufferUtils.html#newUnsafeByteBuffer(int)"><CODE>newUnsafeByteBuffer(int)
</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="clear(java.nio.ByteBuffer, int)"><!-- --></A><H3>
clear
</H3>
<PRE>
public static void
<B>clear
</B>(java.nio.ByteBuffer
buffer,
int
numBytes)
</PRE>
<DL>
<DD>Writes the specified number of zeros to the buffer. This is generally faster than reallocating a new buffer.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package
</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class
</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/BufferUtils.html"><FONT CLASS="NavBarFont1"><B>Use
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index
</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help
</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
libgdx API
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/badlogic/gdx/utils/BooleanArray.html" title="class in com.badlogic.gdx.utils"><B>PREV CLASS
</B></A>
<A HREF="../../../../com/badlogic/gdx/utils/CharArray.html" title="class in com.badlogic.gdx.utils"><B>NEXT CLASS
</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/badlogic/gdx/utils/BufferUtils.html" target="_top"><B>FRAMES
</B></A>
<A HREF="BufferUtils.html" target="_top"><B>NO FRAMES
</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes
</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:
NESTED
|
FIELD
|
<A HREF="#constructor_summary">CONSTR
</A> |
<A HREF="#method_summary">METHOD
</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:
FIELD
|
<A HREF="#constructor_detail">CONSTR
</A> |
<A HREF="#method_detail">METHOD
</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<div style="font-size:9pt"><i>
Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
</i></div>
</BODY>
</HTML>