【发布时间】:2013-05-31 20:57:47
【问题描述】:
Public static void main(String[] args) {
File inFile = null;
if (0 < args.length) {
inFile = new File(args[0]);
}
BufferedInputStream bStream = null;
try {
int read;
bStream = new BufferedInputStream(new FileInputStream(inFile));
while ((read = bStream.read()) > 0) {
getMarker(read, bStream);
System.out.println(read);
}
}
catch (IOException e) {
e.printStackTrace();
}
finally {
try {
if (bStream != null)bStream.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
private static void getMarker(int read, BufferedInputStream bStream) {
}
我想在 bufferedInputStream 中找到长的 1234567890。我可以在 bufferedInputStream 中搜索长类型吗? (我不确定我是否需要“读取”作为参数。我对此表示怀疑,我可能会删除它)。如何搜索 bufferedInputStream?
【问题讨论】:
-
A
long的大小为 8 个字节。你的文件是 8 字节对齐的吗? -
更重要的是,根据文件中的 long 是写成 little endian 还是 big endian,其二进制表示会有所不同。那么,什么是什么?