本文整理汇总了Java中com.google.gwt.typedarrays.shared.Uint8Array.get方法的典型用法代码示例。如果您正苦于以下问题:Java Uint8Array.get方法的具体用法?Java Uint8Array.get怎么用?Java Uint8Array.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.typedarrays.shared.Uint8Array
的用法示例。
在下文中一共展示了Uint8Array.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextChar
import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
private static int nextChar(
Uint8Array byteArray,
int pos)
{
if(pos < byteArray.length())
{
while(++pos < byteArray.length())
{
if((byteArray.get(pos) & 0xc0) != 0x80)
{
return pos;
}
}
}
return pos;
}
示例2: firstEndSpace
import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
private int firstEndSpace(
final Uint8Array byteArray,
int start,
final int length)
{
for(int pos = start + length; --pos >= start;)
{
if(
((byteArray.get(pos) & 0xc0) != 0x80)
&& !isspace(getChar(byteArray, pos)))
{
return nextChar(byteArray, pos);
}
}
return start;
}
示例3: prevChar
import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
private static int prevChar(
Uint8Array byteArray,
int pos)
{
if(pos >= 0)
{
while(--pos >= 0)
{
if((byteArray.get(pos) & 0xc0) != 0x80)
{
return pos;
}
}
}
return pos;
}
示例4: convertBytes
import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
public static byte[] convertBytes(ArrayBuffer buffer) {
Uint8Array array = TypedArrays.createUint8Array(buffer);
byte[] res = new byte[array.length()];
for (int i = 0; i < res.length; i++) {
res[i] = (byte) (array.get(i));
}
return res;
}
示例5: char_equal
import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
private static boolean char_equal(
byte[] first,
int firstPos,
Uint8Array second,
int secondPos)
{
if(first[firstPos] != second.get(secondPos++))
{
return false;
}
if((first[firstPos++] & 0xc0) < 0x80)
{
return true;
}
// skip the first bytes (assumed to be equal)
while(
((first[firstPos] & 0xc0) == 0x80)
&& ((second.get(secondPos) & 0xc0) == 0x80))
{
// both bytes are UTF8 continuation bytes
if(first[firstPos++] != second.get(secondPos++))
{
return false;
}
}
// All continuation bytes up to this position (if any) agree and
// at least one of the byteArrays has run out of continuation bytes.
// The characters are equal if the current bytes are not
// continuation bytes.
return (((first[firstPos] & 0xc0) != 0x80)
&& ((second.get(secondPos) & 0xc0) != 0x80));
}
示例6: getChar
import com.google.gwt.typedarrays.shared.Uint8Array; //导入方法依赖的package包/类
private int getChar(
Uint8Array byteArray,
int pos)
{
int value = byteArray.get(pos++);
if (value > 0 && (value >> 7) == 0)
return value;
switch(value & 0xc0)
{
case 0x80 :
throw new IllegalStateException("Invalid UTF8");
case 0x40 :
return value;
default :
value = (value << 6) | (byteArray.get(pos++) & 0x7f);
if((value & 0x800) == 0)
{
return value & 0x7ff;
}
value = (value << 6) | (byteArray.get(pos++) & 0x7f);
if((value & 0x10000) == 0)
{
return value & 0xffff;
}
value = (value << 6) | (byteArray.get(pos++) & 0x7f);
if((value & 0x200000) == 0)
{
return value & 0x1fffff;
}
value = (value << 6) | (byteArray.get(pos++) & 0x7f);
if((value & 0x4000000) == 0)
{
return value & 0x3ffffff;
}
return (value << 6) | (byteArray.get(pos++) & 0x7f);
}
}