com.mchange.v3.nio.ByteBufferUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.servicemix.bundles.mchange-commons-java
Show all versions of org.apache.servicemix.bundles.mchange-commons-java
This OSGi bundle wraps ${pkgArtifactId} ${pkgVersion} jar file.
package com.mchange.v3.nio;
import java.nio.ByteBuffer;
public final class ByteBufferUtils
{
public static byte[] newArray( ByteBuffer bb )
{
if ( bb.hasArray() ) {
return (byte[]) bb.array().clone();
} else {
byte[] out = new byte[bb.remaining()];
bb.get(out);
return out;
}
}
private ByteBufferUtils()
{}
}