-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIEncoder.cs
More file actions
44 lines (40 loc) · 1.54 KB
/
IEncoder.cs
File metadata and controls
44 lines (40 loc) · 1.54 KB
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
38
39
40
41
42
43
44
namespace Encoder
{
/// <summary>
/// Defines a contract for encoding operations.
/// </summary>
public interface IEncoder
{
/// <summary>
/// Provide conversion and cleaning of input string in order to
/// be compliant to the selected encoding.
/// </summary>
/// <param name="input">Stream to clean</param>
/// <returns>Stream cleaned</returns>
string Cleaner(string input);
/// <summary>
/// Number of rows
/// </summary>
/// <returns>Number of rows for encoding</returns>
int NumberOfRows();
/// <summary>
/// Number of characters per row
/// </summary>
/// <returns>Number of columns for encoding</returns>
int NumberOfColumns();
/// <summary>
/// Converts an ASCII string to a byte array.
/// </summary>
/// <param name="stream">Stream to be converted</param>
/// <param name="clearPage">Whether to clear the page before writing the stream</param>
/// <returns>A byte array representing the encoded ASCII string.</returns>
byte[] FromAscii(string stream, bool clearPage = false);
/// <summary>
/// Converts a byte array to ASCII.
/// </summary>
/// <param name="buffer">Byte array to be converted</param>
/// <param name="bytesRead">Number of bytes in bytearray</param>
/// <returns>A string representing the encoded byte array.</returns>
string ToAscii(byte[] buffer, int bytesRead);
}
}