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


Java Util.readInputStream方法代码示例

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


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

示例1: readResponse

import com.codename1.io.Util; //导入方法依赖的package包/类
protected void readResponse(InputStream input) throws IOException  {
    byte[] bi = Util.readInputStream(input);
    responseText.setText(new String(bi));
    input = new ByteArrayInputStream(bi);
    if(json) {
        JSONParser jp = new JSONParser();
        Hashtable h = jp.parse(new InputStreamReader(input));
        t.setModel(new JSONTreeModel(h));
    } else {
        XMLParser xp = new XMLParser();
        Element response = xp.parse(new InputStreamReader(input));
        t.setModel(new XMLTreeModel(response));
    }
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:15,代码来源:WebServices.java

示例2: toByteArray

import com.codename1.io.Util; //导入方法依赖的package包/类
private byte[] toByteArray(InputStream i) throws IOException {
    if(i instanceof BufferedInputStream) {
        InputStream inp = ((BufferedInputStream)i).getInternal();
        if(inp instanceof NSDataInputStream) {
            return ((NSDataInputStream)inp).getArray();
        }
    }
    return Util.readInputStream(i);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:10,代码来源:IOSImplementation.java

示例3: play

import com.codename1.io.Util; //导入方法依赖的package包/类
@Override
public void play() {
    if(isVideo) {
        if(component == null && nativePlayer) {
            // Mass source of confusion.  If getVideoComponent() has been called, then
            // we can't use the native player.
            if(uri != null) {
                moviePlayerPeer = nativeInstance.createNativeVideoComponent(uri, onCompletionCallbackId);
            } else {
                try {
                    long val = getNSData(stream);
                    if(val > 0) {
                        moviePlayerPeer = nativeInstance.createNativeVideoComponentNSData(val, onCompletionCallbackId);
                        Util.cleanup(stream);
                    } else {
                        byte[] data = Util.readInputStream(stream);
                        Util.cleanup(stream);
                        moviePlayerPeer = nativeInstance.createNativeVideoComponent(data, onCompletionCallbackId);
                    }
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }
            nativeInstance.showNativePlayerController(moviePlayerPeer);
            return;
        }
        if(moviePlayerPeer != 0) {
            nativeInstance.startVideoComponent(moviePlayerPeer);
        }
    } else {
        nativeInstance.playAudio(moviePlayerPeer);                
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:34,代码来源:IOSImplementation.java

示例4: getBlob

import com.codename1.io.Util; //导入方法依赖的package包/类
public byte[] getBlob(int index) throws IOException {
    if(closed) {
        throw new IOException("Cursor is closed");
    }
    try {
        Blob b = resultSet.getBlob(index+1);
        InputStream is = b.getBinaryStream();
        return Util.readInputStream(is);
    } catch (SQLException ex) {
        ex.printStackTrace();
        throw new IOException(ex.getMessage());
    }

}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:15,代码来源:SECursor.java

示例5: create

import com.codename1.io.Util; //导入方法依赖的package包/类
/**
 * Creates an image from the input stream 
 * 
 * @param i the input stream
 * @return newly created encoded image
 * @throws java.io.IOException if thrown by the input stream
 */
public static EncodedImage create(InputStream i) throws IOException {
    byte[] buffer = Util.readInputStream(i);
    if(buffer.length > 200000) {
        System.out.println("Warning: loading large images using EncodedImage.create(InputStream) might lead to memory issues, try using EncodedImage.create(InputStream, int)");
    }
    return new EncodedImage(new byte[][] {buffer});
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:15,代码来源:EncodedImage.java


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