本文整理汇总了Java中java.io.DataInputStream.reset方法的典型用法代码示例。如果您正苦于以下问题:Java DataInputStream.reset方法的具体用法?Java DataInputStream.reset怎么用?Java DataInputStream.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataInputStream
的用法示例。
在下文中一共展示了DataInputStream.reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nextPacketIsAuth
import java.io.DataInputStream; //导入方法依赖的package包/类
public static boolean nextPacketIsAuth(DataInputStream din)
throws IOException {
din.mark(32);
BinaryInputArchive bia = new BinaryInputArchive(din);
boolean firstIsAuth = (bia.readLong("NO_TAG")
== QuorumAuth.QUORUM_AUTH_MAGIC_NUMBER);
din.reset();
return firstIsAuth;
}
示例2: findImageVersion
import java.io.DataInputStream; //导入方法依赖的package包/类
/**
* Check an fsimage datainputstream's version number.
*
* The datainput stream is returned at the same point as it was passed in;
* this method has no effect on the datainputstream's read pointer.
*
* @param in Datainputstream of fsimage
* @return Filesystem layout version of fsimage represented by stream
* @throws IOException If problem reading from in
*/
private int findImageVersion(DataInputStream in) throws IOException {
in.mark(42); // arbitrary amount, resetting immediately
int version = in.readInt();
in.reset();
return version;
}