本文整理了Java中java.io.DataInputStream.reset()
方法的一些代码示例,展示了DataInputStream.reset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataInputStream.reset()
方法的具体详情如下:
包路径:java.io.DataInputStream
类名称:DataInputStream
方法名:reset
暂无
代码示例来源:origin: netty/netty
@Override
public void reset() throws IOException {
in.reset();
}
代码示例来源:origin: redisson/redisson
@Override
public void reset() throws IOException {
in.reset();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void reset() throws IOException {
in.reset();
}
代码示例来源:origin: io.netty/netty
@Override
public void reset() throws IOException {
in.reset();
}
代码示例来源:origin: neo4j/neo4j
@Override
public byte peekByte() throws IOException
{
data.mark(1);
byte value = data.readByte();
data.reset();
return value;
}
}
代码示例来源:origin: apache/hive
protected boolean hasInput() throws IOException {
din.mark(1);
if (din.read() >= 0) {
din.reset();
return true;
}
return false;
}
代码示例来源:origin: apache/nifi
@Override
public SearchTerm<byte[]> nextTerm() throws IOException {
inStream.mark(1);
final int nextByte = inStream.read();
if (nextByte == -1) {
return null;
}
inStream.reset();
final int termLength = inStream.readInt();
final byte[] term = new byte[termLength];
inStream.readFully(term);
return new SearchTerm<>(term);
}
代码示例来源:origin: apache/zookeeper
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;
}
}
代码示例来源:origin: apache/nifi
private SwapDeserializer createSwapDeserializer(final DataInputStream dis) throws IOException {
dis.mark(MAGIC_HEADER.length);
final byte[] magicHeader = new byte[MAGIC_HEADER.length];
try {
StreamUtils.fillBuffer(dis, magicHeader);
} catch (final EOFException eof) {
throw new IOException("Failed to read swap file because the file contained less than 4 bytes of data");
}
if (Arrays.equals(magicHeader, MAGIC_HEADER)) {
final String serializationName = dis.readUTF();
if (serializationName.equals(SchemaSwapDeserializer.getSerializationName())) {
return new SchemaSwapDeserializer();
}
throw new IOException("Cannot find a suitable Deserializer for swap file, written with Serialization Name '" + serializationName + "'");
} else {
// SimpleSwapDeserializer is old and did not write out a magic header.
dis.reset();
return new SimpleSwapDeserializer();
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
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;
}
}
代码示例来源:origin: apache/geode
/**
* Checks to see if the archive has changed since the StatArchiverReader instance was created or
* last updated. If the archive has additional samples then those are read the resource
* instances maintained by the reader are updated.
* <p>
* Once closed a reader can no longer be updated.
*
* @return true if update read some new data.
* @throws IOException if <code>archiveName</code> could not be opened read, or closed.
*/
public boolean update(boolean doReset) throws IOException {
if (this.closed) {
return false;
}
if (!this.updateOK) {
throw new InternalGemFireException(
"update of this type of file is not supported.");
}
if (doReset) {
this.dataIn.reset();
}
int updateTokenCount = 0;
while (this.readToken()) {
updateTokenCount++;
}
return updateTokenCount != 0;
}
代码示例来源:origin: apache/activemq
this.dataIn.reset();
throw new NullPointerException("Cannot convert NULL value to byte.");
} else {
this.dataIn.reset();
throw new MessageFormatException(" not a byte type");
this.dataIn.reset();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
代码示例来源:origin: apache/activemq
this.dataIn.reset();
throw new NullPointerException("Cannot convert NULL value to int.");
} else {
this.dataIn.reset();
throw new MessageFormatException(" not an int type");
this.dataIn.reset();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
代码示例来源:origin: apache/activemq
this.dataIn.reset();
throw new NullPointerException("Cannot convert NULL value to double.");
} else {
this.dataIn.reset();
throw new MessageFormatException(" not a double type");
this.dataIn.reset();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
代码示例来源:origin: apache/activemq
this.dataIn.reset();
throw new NullPointerException("Cannot convert NULL value to short.");
} else {
this.dataIn.reset();
throw new MessageFormatException(" not a short type");
this.dataIn.reset();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
代码示例来源:origin: apache/activemq
this.dataIn.reset();
throw new NullPointerException("Cannot convert NULL value to boolean.");
} else {
this.dataIn.reset();
throw new MessageFormatException(" not a boolean type");
代码示例来源:origin: apache/activemq
this.dataIn.reset();
throw new NullPointerException("Cannot convert NULL value to float.");
} else {
this.dataIn.reset();
throw new MessageFormatException(" not a float type");
this.dataIn.reset();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
代码示例来源:origin: apache/activemq
this.dataIn.reset();
throw new NullPointerException("Cannot convert NULL value to char.");
} else {
this.dataIn.reset();
throw new MessageFormatException(" not a char type");
this.dataIn.reset();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
代码示例来源:origin: plutext/docx4j
/**
* Parses a PFB file into a PFBData object.
* @param in InputStream to load the PFB file from
* @return PFBData memory representation of the font
* @throws IOException In case of an I/O problem
*/
public PFBData parsePFB(InputStream in) throws IOException {
PFBData pfb = new PFBData();
BufferedInputStream bin = new BufferedInputStream(in);
DataInputStream din = new DataInputStream(bin);
din.mark(32);
int firstByte = din.readUnsignedByte();
din.reset();
if (firstByte == 128) {
pfb.setPFBFormat(PFBData.PFB_PC);
parsePCFormat(pfb, din);
} else {
pfb.setPFBFormat(PFBData.PFB_RAW);
parseRAWFormat(pfb, bin);
}
return pfb;
}
代码示例来源:origin: apache/hbase
} else {
if (in.markSupported()) {
in.reset();
parseWritable(in);
} else {
内容来源于网络,如有侵权,请联系作者删除!