Fixed naming conventions
This commit is contained in:
@@ -5,39 +5,39 @@ namespace AMWD.Common.Packing.Tar.Utils
|
||||
{
|
||||
internal class DataWriter : IArchiveDataWriter
|
||||
{
|
||||
private readonly long size;
|
||||
private long remainingBytes;
|
||||
private readonly Stream stream;
|
||||
private readonly long _size;
|
||||
private long _remainingBytes;
|
||||
private readonly Stream _stream;
|
||||
|
||||
public DataWriter(Stream data, long dataSizeInBytes)
|
||||
{
|
||||
size = dataSizeInBytes;
|
||||
remainingBytes = size;
|
||||
stream = data;
|
||||
_size = dataSizeInBytes;
|
||||
_remainingBytes = _size;
|
||||
_stream = data;
|
||||
}
|
||||
|
||||
public bool CanWrite { get; private set; } = true;
|
||||
|
||||
public int Write(byte[] buffer, int count)
|
||||
{
|
||||
if (remainingBytes == 0)
|
||||
if (_remainingBytes == 0)
|
||||
{
|
||||
CanWrite = false;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int bytesToWrite;
|
||||
if (remainingBytes - count < 0)
|
||||
if (_remainingBytes - count < 0)
|
||||
{
|
||||
bytesToWrite = (int)remainingBytes;
|
||||
bytesToWrite = (int)_remainingBytes;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytesToWrite = count;
|
||||
}
|
||||
|
||||
stream.Write(buffer, 0, bytesToWrite);
|
||||
remainingBytes -= bytesToWrite;
|
||||
_stream.Write(buffer, 0, bytesToWrite);
|
||||
_remainingBytes -= bytesToWrite;
|
||||
|
||||
return bytesToWrite;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user