コード例 #1
0
ファイル: Open.cs プロジェクト: galakt/WebHDFS.Kitty
        public async Task ReadBigFile()
        {
            client = new WebHdfsClient(DataTestUtility.HdfsConnStr);
            var openResponse = await client.OpenStream($"{DataTestUtility.HdfsRootDir}/part.0", new OpenParams());

            string firstLine = null;

            using (StreamReader reader = new StreamReader(openResponse))
            {
                firstLine = reader.ReadLine();
            }
            Assert.NotNull(openResponse);
            Assert.False(string.IsNullOrWhiteSpace(firstLine));
        }
コード例 #2
0
ファイル: Open.cs プロジェクト: galakt/WebHDFS.Kitty
        public async Task ReadFileStream()
        {
            client = new WebHdfsClient(DataTestUtility.HdfsConnStr);
            var filePath = $"{DataTestUtility.HdfsRootDir}/{nameof(ReadFileStream)}/sample";
            await client.UploadFile(filePath, File.OpenRead("Samples/SampleTextFile.txt"), Overwrite : true);

            var openResponse = await client.OpenStream(filePath, new OpenParams());

            using (StreamReader reader = new StreamReader(openResponse))
            {
                var openResult = reader.ReadToEnd();
                Assert.True("Some text" == openResult);
            }
        }
コード例 #3
0
ファイル: Open.cs プロジェクト: galakt/WebHDFS.Kitty
        public async Task ReadWithOffsetWithLenght()
        {
            client = new WebHdfsClient(DataTestUtility.HdfsConnStr);
            var filePath = $"{DataTestUtility.HdfsRootDir}/{nameof(ReadWithOffsetWithLenght)}/sample";
            await client.UploadFile(filePath, File.OpenRead("Samples/SampleTextFile.txt"), Overwrite : true);

            var openResponse = await client.OpenStream(filePath, new OpenParams()
            {
                Offset = 2, Length = 2
            });

            using (StreamReader reader = new StreamReader(openResponse))
            {
                var openResult = reader.ReadToEnd();
                Assert.Equal("me", openResult);
            }
        }