Package java.io

Examples of java.io.DataInputStream.reset()


      int status = dis.readUnsignedByte();
      int length = 0;
      //check running status
      if(status < 0x80){
        status = oldStatus;
        dis.reset();
      }
      if(status >= 0xFF){//MetaEvent
        int type = dis.readUnsignedByte();
        length = MidiUtil.readVarLength(dis);
        event = MidiUtil.createMetaEvent(type);
View Full Code Here


                smfParser.tracks = numtracks;
            }
        } finally {
            // if only reading the file format, reset the stream
            if (smfParser == null) {
                dis.reset();
            }
        }
        MidiFileFormat format = new MidiFileFormat(type, divisionType, resolution, fileLength, duration);
        return format;
    }
View Full Code Here

      else
      { // a stream combines the 1st 4 bytes into the total (no reassembly)
        len = Swap.Long(ds.readInt());
        // now do some fancy footwork ...
        umsgSizeInBytes = len - 2; // keep the byte counting intact ...
        ds.reset(); // go back to the beginning and ...
        ds.readShort(); // move over the first 2 bytes
      }
      if (TLinkFactory.debugLevel > 1) DbgLog.log("TPHdr","recv : " + length + " bytes (hdr " + len + " bytes)");
      if (len < length)
      {
View Full Code Here

          DbgLog.log("TPHdr","data : " + "bytes " + umsgSizeInBytes + ", blknum " + blknum + " from " + numblks + " <" + lnkCompCode + ">");
        bytesread += umsgSizeInBytes;
        if (lockout) continue; // simulate total timeout conditions
        if (lnk.getTineProtocol() == 5)
        { // go back to the mark
          ds.reset();
          dTimeStampUSEC = (int)Swap.Short(ds.readShort()) * 1000;
          dFormat = (short)ds.readByte();
          lnkCounter = (short)ds.readByte();
          dTimeStamp = Swap.Long(ds.readInt());
          lnkStarttime = Swap.Long(ds.readInt());
View Full Code Here

      else
      { // a stream combines the 1st 4 bytes into the total (no reassembly)
        len = Swap.Long(ds.readInt());
        // now do some fancy footwork ...
        umsgSizeInBytes = len - 2; // keep the byte counting intact ...
        ds.reset(); // go back to the beginning and ...
        ds.readShort(); // move over the first 2 bytes
      }
      if (TLinkFactory.debugLevel > 1) DbgLog.log("TPHdr","recv : " + length + " bytes (hdr " + len + " bytes)");
      if (len < length)
      {
View Full Code Here

        logVersion = in.readByte();
      } catch (EOFException e) {
        available = false;
      }
      if (available) {
        in.reset();
        if (logVersion >= 0)
          logVersion = 0;
        else
          logVersion = in.readInt();
        if (logVersion < FSConstants.LAYOUT_VERSION) // future version
View Full Code Here

                smfParser.tracks = numtracks;
            }
        } finally {
            // if only reading the file format, reset the stream
            if (smfParser == null) {
                dis.reset();
            }
        }
        MidiFileFormat format = new MidiFileFormat(type, divisionType, resolution, fileLength, duration);
        return format;
    }
View Full Code Here

   
        This.fTrie = new CharTrie(dis, fTrieFoldingFunc)// Deserialize the TRIE, leaving input
                                                //  stream at an unknown position, preceding the
                                                //  padding between TRIE and following section.
   
        dis.reset();                            // Move input stream back to marked position at
                                                //   the start of the serialized TRIE.  Now our
                                                //   "pos" variable and the input stream are in
                                                //   agreement.
       
        //
View Full Code Here

        data = new byte[length];
        writeInt(rootRes, data, 0);
        writeInt(indexLength, data, 4);

        // now reset to the mark, which was set after reading rootRes and indexLength
        ds.reset();
        ds.readFully(data, 8, length-8);
    }

    /**
     * Gets the full name of the resource with suffix.
View Full Code Here

        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);
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.