How do I read strings in J2ME?(如何在 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.
有谁知道您应该如何以独立于平台的方式(即在两个不同型号的启用 java 的手机之间)从 InputStream 或 InputStreamReader 读取字符串?
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().
确实需要对从 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 中读取字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 J2ME 中读取字符串?
基础教程推荐
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 存储 20 位数字的数据类型 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
