示例#1
0
        /**
         * <p>
         * Populates the specified outputStreamSource (List&lt;int[]&gt;) with an encoded
         * array of integers - using the specified field names and field types indicated.
         * </p><p>
         * This method process one single record, and is called iteratively to process an
         * input stream (internally by the {@link #getOutputStream()} method which will process
         * </p><p>
         * <b>WARNING:</b>  <em>When inserting data <b><em>MANUALLY</em></b>, you must remember that the first index
         * must be a sequence number, which means you may have to insert that by hand. Typically
         * this method is called internally where the underlying sensor does the sequencing automatically.</em>
         * </p>
         *
         * @param arr                       The string array of field values
         * @param fieldNames                The field names
         * @param fieldTypes                The field types
         * @param outputStreamSource        A list object to hold the encoded int[]
         * @param isParallel                Whether the underlying stream is parallel, if so this method
         *                                  executes a binary search for the proper insertion index. The {@link List}
         *                                  handed in should thus be a {@link LinkedList} for faster insertion.
         */
        private int[] Input(string[] arr, string[] fieldNames, FieldMetaType[] fieldTypes, List <int[]> outputStreamSource, bool isParallel)
        {
            ProcessHeader(arr);

            int[] encoding = encoder.Encode(inputMap);

            if (isParallel)
            {
                outputStreamSource[PadTo(int.Parse(arr[0]), outputStreamSource)] = encoding;
            }

            return(encoding);
        }
示例#2
0
 /// <summary>
 /// Encodes an object with the appropriate encoding or null if it cannot
 /// be encoded.
 /// </summary>
 /// <param name="obj">Data to encode</param>
 public byte[] Encode(T obj)
 {
     return(_encoder.Encode(obj));
 }