当前位置: 首页>>代码示例>>Java>>正文


Java Util.convertUTF8WithBuf方法代码示例

本文整理汇总了Java中org.apache.harmony.luni.util.Util.convertUTF8WithBuf方法的典型用法代码示例。如果您正苦于以下问题:Java Util.convertUTF8WithBuf方法的具体用法?Java Util.convertUTF8WithBuf怎么用?Java Util.convertUTF8WithBuf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.harmony.luni.util.Util的用法示例。


在下文中一共展示了Util.convertUTF8WithBuf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: decodeUTF

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
private static String decodeUTF(int utfSize, DataInput in) throws IOException {
    byte[] buf = new byte[utfSize];
    char[] out = new char[utfSize];
    in.readFully(buf, 0, utfSize);

    return Util.convertUTF8WithBuf(buf, out, 0, utfSize);
}
 
开发者ID:cloudeecn,项目名称:fiscevm,代码行数:8,代码来源:DataInputStream.java

示例2: readUTF

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
public String readUTF() throws IOException {
	ByteOrder byteOrder = getByteOrder();
	setByteOrder(ByteOrder.BIG_ENDIAN);
	final int size = readUnsignedShort();
	final byte[] buf = new byte[size];
	final char[] out = new char[size];

	readFully(buf, 0, size);
	setByteOrder(byteOrder);
	//return new DataInputStream(new ByteArrayInputStream(buff)).readUTF();
	return Util.convertUTF8WithBuf(buf, out, 0, size);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:13,代码来源:ImageInputStreamImpl.java

示例3: decodeUTF

import org.apache.harmony.luni.util.Util; //导入方法依赖的package包/类
String decodeUTF(int utfSize) throws IOException {
    byte[] buf;
    char[] out = null;
    boolean makeBuf = true;

    /*
     * Try to avoid the synchronization -- if we get a stale value for
     * useShared then there is no foul below, but those that sync on the
     * lock must see the right value.
     */
    if (utfSize <= MAX_BUF_SIZE && useShared) {
        synchronized (cacheLock) {
            if (useShared) {
                useShared = false;
                makeBuf = false;
            }
        }
    }
    if (makeBuf) {
        buf = new byte[utfSize];
        out = new char[utfSize];
    } else {
        /*
         * Need to 'sample' byteBuf and charBuf before using them because
         * they are not protected by the cacheLock. They may get out of sync
         * with the static and one another, but that is ok because we
         * explicitly check and fix their length after sampling.
         */
        buf = byteBuf;
        if (buf.length < utfSize) {
            buf = byteBuf = new byte[utfSize];
        }
        out = charBuf;
        if (out.length < utfSize) {
            out = charBuf = new char[utfSize];
        }
    }

    readFully(buf, 0, utfSize);
    String result;
    result = Util.convertUTF8WithBuf(buf, out, 0, utfSize);
    if (!makeBuf) {
        /*
         * Do not synchronize useShared on cacheLock, it will make it back
         * to main storage at some point, and no harm until it does.
         */
        useShared = true;
    }
    return result;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:51,代码来源:DataInputStream.java


注:本文中的org.apache.harmony.luni.util.Util.convertUTF8WithBuf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。