Package java.io

Examples of java.io.DataInputStream.mark()


    long startTime = FSNamesystem.now();

    DataInputStream in = new DataInputStream(new BufferedInputStream(edits));
    try {
      // Read log file version. Could be missing.
      in.mark(4);
      // If edits log is greater than 2G, available method will return negative
      // numbers, so we avoid having to call available
      boolean available = true;
      try {
        logVersion = in.readByte();
View Full Code Here


     */
    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);
View Full Code Here

       /* byte unicodeVersion[] = */ICUBinary.readHeader(b, DATA_FORMAT_ID, this);
        DataInputStream d = new DataInputStream(b);

        // Record the origin position of the file.  Keep enough around
        // to seek back to the start of the header.
        d.mark(256);

        short enumToName_offset = d.readShort();
        short nameToEnum_offset = d.readShort();
        short enumToValue_offset = d.readShort();
        short total_size = d.readShort();
View Full Code Here

        //     back in sync.
        //
        dis.skip(This.fHeader.fTrie - pos);     // seek input stream from end of previous section to
        pos = This.fHeader.fTrie;               //   to the start of the trie
   
        dis.mark(This.fHeader.fTrieLen+100);    // Mark position of start of TRIE in the input
                                                //  and tell Java to keep the mark valid so long
                                                //  as we don't go more than 100 bytes past the
                                                //  past the end of the TRIE.
   
        This.fTrie = new CharTrie(dis, fTrieFoldingFunc)// Deserialize the TRIE, leaving input
View Full Code Here

        // original comments indicated that we need to use read(byte[]) rather than readInt()
        // to avoid socket timeouts - don't understand, but don't want to risk change.

        // first read the data necessary to know the length of the payload
        DataInputStream dis = new DataInputStream(is);
        dis.mark(SIZE_INT);
        // this pulls through SIZE_INT bytes
        if (null == super.read(dis, SIZE_INT))
        {
            return null; // eof
        }
View Full Code Here

    if (edits != null) {
      DataInputStream in = new DataInputStream(new BufferedInputStream(
                                new FileInputStream(edits)));
      try {
        // Read log file version. Could be missing.
        in.mark(4);
        // If edits log is greater than 2G, available method will return negative
        // numbers, so we avoid having to call available
        boolean available = true;
        try {
          logVersion = in.readByte();
View Full Code Here

        lnkCompCode = Swap.Short(ds.readShort());
        numblks = Swap.Short(ds.readShort());
        blknum = Swap.Short(ds.readShort());
        mtu = Swap.Short(ds.readShort());
        umtu = TPHdr.UnsignedShort(mtu);
        ds.mark(umsgSizeInBytes);
        dFormat = Swap.Short(ds.readShort());
        lnkCounter = Swap.Short(ds.readShort());
        srvProtocol = Swap.Short(ds.readShort());
        xferReason = Swap.Short(ds.readShort());
        lnkStarttime = Swap.Long(ds.readInt());
View Full Code Here

          previousLength = length;
        }

        os.flush();
        DataInputStream is = new DataInputStream(new ByteArrayInputStream(bos.toByteArray()));
        is.mark(Integer.MAX_VALUE);
        fSpoofData.initPtrs(is);
      }

      public static void buildConfusableData(final SpoofData spData, final Reader confusables) throws java.io.IOException,
          ParseException {
View Full Code Here

      // Seek past the ICU data header.
      // TODO: verify that the header looks good.
      DataInputStream dis = new DataInputStream(new BufferedInputStream(is));
      dis.skip(0x80);
      assert (dis.markSupported());
      dis.mark(Integer.MAX_VALUE);

      fRawData = new SpoofDataHeader(dis);
      initPtrs(dis);
    }
View Full Code Here

            if (stream == null)
                throw new IOException("Stream is null");
            dis = new DataInputStream(stream);
        }
        if (smfParser == null) {
            dis.mark(maxReadLength);
        } else {
            smfParser.stream = dis;
        }

        int type;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.