如何在J2ME中读取字符串? [英] How do I read strings in J2ME?

查看:147
本文介绍了如何在J2ME中读取字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MIDP 2.0(JSR 118),我只是注意到J2ME中没有读取器的字符串。

I'm using the MIDP 2.0 (JSR 118) and I just noticed that there is no reader for strings in J2ME.

有谁知道你是怎么回事以平台无关的方式从 InputStream InputStreamReader 中读取字符串(即两个不同型号的java手机之间) )?

Does anyone know how you are supposed to read Strings from an InputStream or InputStreamReader in a platform independent way (i.e. between two java enabled cell phones of different models)?

推荐答案

或者看看 DataInputStream.readUTF()

Alternatively have a look at DataInputStream.readUTF().

它确实需要对从InputStream读取的字符串进行适当编码(如相应的 DataOutputStream.writeUTF(String) )所以它可能不是你想要的 - 但它确实适用于不同的手机/型号等。

It does required that the string being read off the InputStream be encoded appropriately (as in by a corresponding DataOutputStream.writeUTF(String)) so it might not be what you're looking for - but it does work across different phones/models etc.

这篇关于如何在J2ME中读取字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆