@Override public void reset() throws IOException { in.reset(); }
@Override public void reset() throws IOException { in.reset(); }
@Override public void reset() throws IOException { in.reset(); }
@Override public void reset() throws IOException { in.reset(); }
@Override public byte peekByte() throws IOException { data.mark(1); byte value = data.readByte(); data.reset(); return value; } }
protected boolean hasInput() throws IOException { din.mark(1); if (din.read() >= 0) { din.reset(); return true; } return false; }
@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); }
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; } }
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(); } }
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; } }
/** * 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; }
/** * 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; }
} else { if (in.markSupported()) { in.reset(); parseWritable(in); } else {