示例#1
0
        public void TestDeserialize()
        {
            var test =
                "<?xml version=\"1.0\" encoding=\"utf-8\"?><task>    <metadata>        <name>Hello World</name>        <id>0d852117-6adf-4af7-8c8b-f52300ccae15</id>        <!-- <isActive>true</isActive> that must be defined in the server and should not be part of the task -->    </metadata>    <audience>        <all />        <client id=\"1\" />        <group id=\"testGroup\" />    </audience>    <conditions>        <OperatingSystem min=\"WinVista\" />    </conditions>    <transmission>        <DateTime date=\"\" />    </transmission>    <execution>        <IdleExecutionEvent idleTime=\"120\" />    </execution>    <stop>        <Duration time=\"00:01:00\" />        <DateTime date=\"\" />    </stop>    <commands>        <command name=\"Maze.WakeOnLan\" modules=\"SystemUtilties;TaskManager\">            asdasdadsdas        </command>    </commands></task>";


            var reader = new ReaderImpl(XDocument.Parse(test));

            Assert.Equal("Hello World", reader.GetName());
            Assert.Equal(Guid.Parse("0d852117-6adf-4af7-8c8b-f52300ccae15"), reader.GetId());
        }
示例#2
0
        public void readFields(DataInput @in)
        {
            //deserialize path, offset, length using FileSplit
            base.readFields(@in);

            byte flags = @in.readByte();

            hasFooter  = (FOOTER_FLAG & flags) != 0;
            isOriginal = (ORIGINAL_FLAG & flags) != 0;
            hasBase    = (BASE_FLAG & flags) != 0;
            bool hasFileId = (HAS_FILEID_FLAG & flags) != 0;

            deltas.Clear();
            int numDeltas = @in.readInt();

            for (int i = 0; i < numDeltas; i++)
            {
                AcidInputFormat.DeltaMetaData dmd = new AcidInputFormat.DeltaMetaData();
                dmd.readFields(@in);
                deltas.Add(dmd);
            }
            if (hasFooter)
            {
                // deserialize FileMetaInfo fields
                string compressionType = Text.readString(@in);
                int    bufferSize      = WritableUtils.readVInt(@in);
                int    metadataSize    = WritableUtils.readVInt(@in);

                // deserialize FileMetaInfo field footer
                int        footerBuffSize = WritableUtils.readVInt(@in);
                ByteBuffer footerBuff     = ByteBuffer.allocate(footerBuffSize);
                @in.readFully(footerBuff.array(), 0, footerBuffSize);
                OrcFile.WriterVersion writerVersion =
                    ReaderImpl.getWriterVersion(WritableUtils.readVInt(@in));

                fileMetaInfo = new FileMetaInfo(compressionType, bufferSize,
                                                metadataSize, footerBuff, writerVersion);
            }
            if (hasFileId)
            {
                fileId = @in.readLong();
            }
        }
 /**
  * Create a reader that reads from the first key larger than minKey to any
  * keys equal to maxKey.
  * @param key the key to read into
  * @param reader the ORC file reader
  * @param bucket the bucket number for the file
  * @param minKey only return keys larger than minKey if it is non-null
  * @param maxKey only return keys less than or equal to maxKey if it is
  *               non-null
  * @param options options to provide to read the rows.
  * @param statementId id of SQL statement within a transaction
  * @
  */
 public ReaderPair(ReaderKey key, Reader reader, int bucket,
            RecordIdentifier minKey, RecordIdentifier maxKey,
            ReaderImpl.Options options, int statementId)
 {
     this.reader = reader;
     this.key = key;
     this.maxKey = maxKey;
     this.bucket = bucket;
     // TODO use stripe statistics to jump over stripes
     recordReader = reader.rowsOptions(options);
     this.statementId = statementId;
     // advance the reader until we reach the minimum key
     do
     {
         next(nextRecord);
     } while (nextRecord != null &&
         (minKey != null && key.compareRow(minKey) <= 0));
 }