You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/02/04 09:31:39 UTC
[avro] branch branch-1.11 updated: AVRO-3359 update formatting of DeflateCodec (#1510)
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/branch-1.11 by this push:
new ea797c9 AVRO-3359 update formatting of DeflateCodec (#1510)
ea797c9 is described below
commit ea797c9226bb6a29293901e670038cc2dffb3692
Author: Kyle Schoonover <ky...@minmaxcorp.com>
AuthorDate: Fri Feb 4 01:31:17 2022 -0800
AVRO-3359 update formatting of DeflateCodec (#1510)
* AVRO-3359 update formatting of DeflateCodec
* AVRO-3359: Simplify boolean expression
Co-authored-by: Kyle T. Schoonover <Ky...@nordstrom.com>
Co-authored-by: Martin Grigorov <ma...@users.noreply.github.com>
(cherry picked from commit 6eebdf9777117e0301603d227b6b275616624255)
---
lang/csharp/src/apache/main/File/DeflateCodec.cs | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lang/csharp/src/apache/main/File/DeflateCodec.cs b/lang/csharp/src/apache/main/File/DeflateCodec.cs
index 4de017a..8ef9fce 100644
--- a/lang/csharp/src/apache/main/File/DeflateCodec.cs
+++ b/lang/csharp/src/apache/main/File/DeflateCodec.cs
@@ -23,7 +23,8 @@ namespace Avro.File
/// <summary>
/// Implements deflate compression and decompression.
/// </summary>
- /// <seealso cref="DeflateStream"/>
+ /// <seealso cref="Codec" />
+ /// <seealso cref="DeflateStream" />
public class DeflateCodec : Codec
{
/// <inheritdoc/>
@@ -37,6 +38,7 @@ namespace Avro.File
{
Compress.Write(uncompressedData, 0, uncompressedData.Length);
}
+
return outStream.ToArray();
}
@@ -56,7 +58,7 @@ namespace Avro.File
/// <inheritdoc/>
public override byte[] Decompress(byte[] compressedData, int length)
{
-
+
MemoryStream inStream = new MemoryStream(compressedData);
MemoryStream outStream = new MemoryStream();
@@ -66,14 +68,20 @@ namespace Avro.File
{
CopyTo(Decompress, outStream);
}
+
return outStream.ToArray();
}
+ /// <summary>
+ /// Copies to stream.
+ /// </summary>
+ /// <param name="from">stream you are copying from</param>
+ /// <param name="to">stream you are copying to</param>
private static void CopyTo(Stream from, Stream to)
{
byte[] buffer = new byte[4096];
int read;
- while((read = from.Read(buffer, 0, buffer.Length)) != 0)
+ while ((read = from.Read(buffer, 0, buffer.Length)) != 0)
{
to.Write(buffer, 0, read);
}
@@ -88,9 +96,7 @@ namespace Avro.File
/// <inheritdoc/>
public override bool Equals(object other)
{
- if (this == other)
- return true;
- return this.GetType().Name == other.GetType().Name;
+ return this == other || GetType().Name == other.GetType().Name;
}
/// <inheritdoc/>