Package java.io

Examples of java.io.DataInputStream.mark()


    {
      try
      {
        DataInputStream data = new DataInputStream(in);
        byte[] b = new byte[3];
        data.mark(b.length);
        data.readFully(b);
        if (b[0] == 'C' && b[1] == 'W' && b[2] == 'S' ||
                    b[0] == 'F' && b[1] == 'W' && b[2] == 'S')
        {
          data.reset();
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( in.available() > 0 ) {
        logVersion = in.readByte();
        in.reset();
        if( logVersion >= 0 )
          logVersion = 0;
View Full Code Here

    Arrays.fill(recentOpcodeOffsets, -1);

    DataInputStream in = new DataInputStream(tracker);
    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

    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

         */
        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

        //     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

        //     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

    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

    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

            out.close();
            DataInputStream in = new DataInputStream(blob.getInputStream());
            byte[] data1 = new byte[sourceData1.length];
            byte[] data2 = new byte[sourceData2.length];
            in.readFully(data1);
            in.mark(sourceData2.length);
            in.readFully(data2);
            in.reset();
            in.readFully(data2);
            assertTrue(Arrays.equals(sourceData1, data1));
            assertTrue(Arrays.equals(sourceData2, data2));
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.