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


Java StreamConnection.openDataOutputStream方法代码示例

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


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

示例1: main

import javax.microedition.io.StreamConnection; //导入方法依赖的package包/类
public static void main(String[] args) {
    // Default to indicate error
    int returnCode = -1;
    try {
        StreamConnection connection = (StreamConnection) Connector.open("uei:");
        DataOutputStream out = connection.openDataOutputStream();
        out.writeInt(args.length);
        for (int i=0; i < args.length; i++) {
            out.writeUTF(args[i]);
        }
        out.close();
        InputStream in = connection.openInputStream();
        returnCode = in.read();
        in.close();
    } catch (Throwable t) {
        t.printStackTrace();
    } finally {
        System.exit(returnCode);
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:21,代码来源:Launcher.java

示例2: processConnection

import javax.microedition.io.StreamConnection; //导入方法依赖的package包/类
/**
 * Let the event listener process the connection.
 */
private void processConnection(StreamConnection conn) {

     DataOutputStream dos = null;
     DataInputStream dis = null;

     try{
         dos = new DataOutputStream(conn.openDataOutputStream());
         dis = new DataInputStream(conn.openDataInputStream());
         this.eventListener.processConnection(dis, dos);
     }catch(IOException e){
         raiseError("Error getting data stream",e);
     }
   }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:17,代码来源:BluetoothServer.java

示例3: openConnection

import javax.microedition.io.StreamConnection; //导入方法依赖的package包/类
public boolean openConnection(String destIpAddr, String destPort) {
    address = "socket://" + destIpAddr + ":" + destPort;
    try {
        conn = (StreamConnection) Connector.open(address);
        outStream = new OutputStreamWriter(conn.openDataOutputStream());
    } catch (Throwable e) {
        System.out.println("Logger connection open exception: " + e.toString() + " to: " + address);
        return false;
    }
    return true;
}
 
开发者ID:wildstang111,项目名称:2013_drivebase_proto,代码行数:12,代码来源:LoggerImpl.java

示例4: updateConfig

import javax.microedition.io.StreamConnection; //导入方法依赖的package包/类
public boolean updateConfig(String destIpAddr, String destPort) {

        address = "socket://" + destIpAddr + ":" + destPort;
        closeConnection();
        try {
            conn = (StreamConnection) Connector.open(address);
            outStream = new OutputStreamWriter(conn.openDataOutputStream());
        } catch (Throwable e) {
            return false;
        }
        return true;
    }
 
开发者ID:wildstang111,项目名称:2013_drivebase_proto,代码行数:13,代码来源:LoggerImpl.java


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