Package java.io

Examples of java.io.DataInputStream.mark()


            if (matches.length > 0) {
                for (byte[] match : matches) {
                    boolean matched = false;
                    while (matched == false) {
                        try {
                            dis.mark(1000);
                            byte[] possible = new byte[match.length];
                            dis.readFully(possible);
                            assertEquals(possible, match);
                            matched = true;
                        } catch (AssertionError ex) {
View Full Code Here


        System.out.println("New MIDI message");
        Event event = null;
        ByteArrayInputStream bais = new ByteArrayInputStream(message.getMessage());
        DataInputStream dis = new DataInputStream(bais);
        try {
            dis.mark(2);
            int status = dis.readUnsignedByte();
            int length = 0;
            //check running status
            if (status < 0x80) {
                status = oldStatus;
View Full Code Here

    System.out.println("New MIDI message");
    Event event = null;
    ByteArrayInputStream bais=new ByteArrayInputStream(message.getMessage());
    DataInputStream dis = new DataInputStream(bais);
    try{
      dis.mark(2);
      int status = dis.readUnsignedByte();
      int length = 0;
      //check running status
      if(status < 0x80){
        status = oldStatus;
View Full Code Here

            dis = (DataInputStream) stream;
        } else {
            dis = new DataInputStream(stream);
        }
        if (smfParser == null) {
            dis.mark(maxReadLength);
        } else {
            smfParser.stream = dis;
        }

        int type;
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

        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

    if (edits != null) {
      DataInputStream in = new DataInputStream(
                                               new BufferedInputStream(
                                                                       new FileInputStream(edits)));
      // 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

            dis = (DataInputStream) stream;
        } else {
            dis = new DataInputStream(stream);
        }
        if (smfParser == null) {
            dis.mark(maxReadLength);
        } else {
            smfParser.stream = dis;
        }

        int type;
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

         */
        rootRes = ds.readInt();

        // read the variable-length indexes[] array
        int indexLength = ds.readInt();
        ds.mark((indexLength-1)*4);

        indexes = new int[indexLength];
        indexes[URES_INDEX_LENGTH] = indexLength;

        for(int i=1; i<indexLength; i++){
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.