예제 #1
0
 /// <exception cref="System.IO.IOException"/>
 private IFile.Reader <Text, Text> GetReader(int i, bool isCompressedInput)
 {
     IFile.Reader <Text, Text> readerMock = Org.Mockito.Mockito.Mock <IFile.Reader>();
     Org.Mockito.Mockito.When(readerMock.GetLength()).ThenReturn(30l);
     Org.Mockito.Mockito.When(readerMock.GetPosition()).ThenReturn(0l).ThenReturn(10l)
     .ThenReturn(20l);
     Org.Mockito.Mockito.When(readerMock.NextRawKey(Matchers.Any <DataInputBuffer>())).
     ThenAnswer(GetKeyAnswer("Segment" + i, isCompressedInput));
     Org.Mockito.Mockito.DoAnswer(GetValueAnswer("Segment" + i)).When(readerMock).NextRawValue
         (Matchers.Any <DataInputBuffer>());
     return(readerMock);
 }
예제 #2
0
        /// <exception cref="System.IO.IOException"/>
        private void ReadOnDiskMapOutput(Configuration conf, FileSystem fs, Path path, IList
                                         <string> keys, IList <string> values)
        {
            FSDataInputStream @in = CryptoUtils.WrapIfNecessary(conf, fs.Open(path));

            IFile.Reader <Text, Text> reader = new IFile.Reader <Text, Text>(conf, @in, fs.GetFileStatus
                                                                                 (path).GetLen(), null, null);
            DataInputBuffer keyBuff   = new DataInputBuffer();
            DataInputBuffer valueBuff = new DataInputBuffer();
            Text            key       = new Text();
            Text            value     = new Text();

            while (reader.NextRawKey(keyBuff))
            {
                key.ReadFields(keyBuff);
                keys.AddItem(key.ToString());
                reader.NextRawValue(valueBuff);
                value.ReadFields(valueBuff);
                values.AddItem(value.ToString());
            }
        }