- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用运行 android-7 (2.1) 的模拟器和运行 android-8 (2.2) 的 moto-defy 来玩一个简单的 android 应用程序。
我遇到了一个有趣的问题,即 CSV 解析应用程序在模拟器上失败,但在 defy 和常规 java 应用程序(使用 sun java)中成功。
我追踪到问题,原因是android-7的StringReader实现不支持否定跳过操作:
Android-7:
/**
* Skips {@code amount} characters in the source string. Subsequent calls of
* {@code read} methods will not return these characters unless {@code
* reset()} is used.
*
* @param ns
* the maximum number of characters to skip.
* @return the number of characters actually skipped or 0 if {@code ns < 0}.
* @throws IOException
* if this reader is closed.
* @see #mark(int)
* @see #markSupported()
* @see #reset()
*/
@Override
public long skip(long ns) throws IOException {
synchronized (lock) {
if (isClosed()) {
throw new IOException(Msg.getString("K0083")); //$NON-NLS-1$
}
if (ns <= 0) {
return 0;
}
long skipped = 0;
if (ns < this.count - pos) {
pos = pos + (int) ns;
skipped = ns;
} else {
skipped = this.count - pos;
pos = this.count;
}
return skipped;
}
}
J2SE 1.6:
/**
* Skips the specified number of characters in the stream. Returns
* the number of characters that were skipped.
*
* <p>The <code>ns</code> parameter may be negative, even though the
* <code>skip</code> method of the {@link Reader} superclass throws
* an exception in this case. Negative values of <code>ns</code> cause the
* stream to skip backwards. Negative return values indicate a skip
* backwards. It is not possible to skip backwards past the beginning of
* the string.
*
* <p>If the entire string has been read or skipped, then this method has
* no effect and always returns 0.
*
* @exception IOException If an I/O error occurs
*/
public long skip(long ns) throws IOException {
synchronized (lock) {
ensureOpen();
if (next >= length)
return 0;
// Bound skip by beginning and end of the source
long n = Math.min(length - next, ns);
n = Math.max(-next, n);
next += n;
return n;
}
}
因此,Android 版本不会向后跳过(在某些情况下解析器使用它来预读一个字符),而是保持向前一个字符。
我的问题是,J2SE 规范中的各种不兼容性和变体是否在任何地方都有记录?如果没有,你们还遇到了什么其他问题。
谢谢,p。
最佳答案
一个值得关注的地方是 Android 问题跟踪器。
另一个值得关注的地方是 Apache Harmony 问题跟踪器。
不可否认,使用问题跟踪器将涉及搜索而不是浏览经过仔分割类的问题的网络。您可以将此视为一个机会...
FWIW - 搜索 Harmony 问题跟踪器显示在各种流类中 skip
的行为存在一些问题。有一个问题提示某些类的行为与 javadoc 不匹配......并且关闭说它确实与 RI 行为匹配,因此错误在 javadoc 中。
我的看法是,Sun/Oracle 因拒绝以合理的条件将 TCK 许可给 Apache Harmony 项目而对此类事情负有很多责任。
关于android java 实现缺陷.. 是否记录在案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6721928/
我的 slideToggle 在幻灯片切换的底部有点跳动。会不会是因为那里有一个按钮之类的。任何使它更平滑的方法。尝试使用缓动但不是很成功。有什么建议 点击视频设置自己看看 The site $(do
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
概述: 我的 B 对象是一个 100 000 * 5000 的 2 GB 大矩阵 我的 A 对象较小 1000 * 5000 analyse_with_glm <- function(Y) { c
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 6年前关闭。 Improve t
我在从 SQL Server (2008R2) 数据库中的 NVARCHAR 字段检索加密数据时遇到了问题,对于某些记录,我的 C# .NET 应用程序中数据的字符串值与数据库记录中的数据字符串值不同
我从 main.cpp 中包含两个头文件,它们在匿名命名空间中具有以下定义:const string strToken = ("%");使用 g++ 4.9 版编译结果如下: In file incl
我正在测试的代码中出现信任边界冲突。该代码在 session 中添加表单,并且由于违反信任边界而存在缺陷 Inside Struts Action class execute method { Ed
这个问题没有与之相关的实际问题,它更多的是一个好奇的问题,想知道我是否过于字面意思;)。 所以我一直在努力尽可能多地理解 c++ 标准。今天,在深入研究标准时,我注意到了这一点 (ISO/IEC 14
在我的数据库中,我必须做一个Circular Reference(cycle)来获取我想要的数据,我不知道如何重新排序表来获取我想要的数据而不需要循环. 这是我的数据库的模式(或模型)——只有表名是英
我有一个代表一组数字的类。构造函数接受三个参数: startValue 、 endValue 和 stepSize 。 该类负责保存一个列表,其中包含考虑 stepSize 的开始值和结束值之间的所有
如何删除下图中标记的三个间隙? 此代码可在 http://jsfiddle.net/69zj6smo/ 获得- 调整渲染区域的大小以查看通常存在的一些线条。 让我感到困惑的是,我认为我总是创建这样的流
double 的位格式在第一位存储符号。 double的C#哈希算法是高低32位二进制异或。 因此,当您对 double A 及其负数 -A 进行哈希处理时,哈希值的唯一区别在于第一位。 要散列多个字
当我在 Action 中使用重定向时,afterAction 方法(在 controller.php 中)不起作用!我该如何解决这个问题? 注意:我不能使用 beforeAction 因为我在我的 A
毫无疑问,还有其他可能更好的方法可以做到这一点,但我正在努力了解这里发生了什么。 在下面的示例中,coverity 在第四行报告了 FORWARD_NULL 缺陷。 double? foo = nul
我们希望针对 Jenkins 中失败的构建自动在 Jira 中创建缺陷。如果您成功完成了此操作,可以与我分享吗? 最佳答案 您应该能够使用JIRA plugin来做到这一点,以及“JIRA:创建问题”
有人能解释一下为什么 VeraCode 似乎认为使用 name 作为公共(public)属性(property)是一个坏主意,并提出了一个好的缓解措施吗? 代码(JavaScript): var Ba
我认为这是 C++11 标准中的一个(次要)缺陷。在 [dcl.dcl] 中我们有: simple-declaration: decl-specifier-seqopt init-
我做了以下... private static IDbConnectionProvider CreateSqlConnectionProvider(DbConfig dbConfig) { r
我现在在运行我的 cakephp 应用程序时遇到了很多麻烦。 在将 vom lenny 升级为 squeeze(甚至尝试完全重新安装 sqeeze)之后,imagick 的速度非常慢,以至于它只是关闭
我收到来自 Veracode 的信任边界违规。我的代码是 userName= req.getParameter(Constant.USERNAME); session.setAttribute(Con
我是一名优秀的程序员,十分优秀!