-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (33 loc) · 997 Bytes
/
Program.cs
File metadata and controls
37 lines (33 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.IO;
using System.IO.Compression;
namespace pelda_tomorites_gzip
{
class Program
{
static void Main(string[] args)
{
using (var file = File.Create("test.txt"))
{
using (var gZipStream = new GZipStream(file, CompressionMode.Compress))
{
using (var writer = new StreamWriter(gZipStream))
{
writer.WriteLine("Ez egy teszt szöveg");
}
}
}
using (var file = File.OpenRead("test.txt"))
{
using (var gZipStream = new GZipStream(file, CompressionMode.Decompress))
{
using (var reader = new StreamReader(gZipStream))
{
Console.WriteLine(reader.ReadLine());
}
}
}
Console.ReadKey();
}
}
}