Skip to content

Commit 60087ad

Browse files
committed
Add missing summary comments in many places.
1 parent f070034 commit 60087ad

16 files changed

+142
-63
lines changed

src/BZip2/BZip2InputStream.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public override void Flush()
157157
/// </summary>
158158
/// <param name="offset">A byte offset relative to the <paramref name="origin"/> parameter.</param>
159159
/// <param name="origin">A value of type <see cref="SeekOrigin"/> indicating the reference point used to obtain the new position.</param>
160+
/// <returns>The new position of the stream.</returns>
160161
/// <exception cref="NotSupportedException">Any access</exception>
161162
public override long Seek(long offset, SeekOrigin origin)
162163
{

src/BZip2/BZip2OutputStream.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ public override long Position {
193193
/// <summary>
194194
/// Sets the current position of this stream to the given value.
195195
/// </summary>
196+
/// <param name="offset">The point relative to the offset from which to being seeking.</param>
197+
/// <param name="origin">The reference point from which to begin seeking.</param>
198+
/// <returns>The new position in the stream.</returns>
196199
public override long Seek(long offset, SeekOrigin origin)
197200
{
198201
throw new NotSupportedException("BZip2OutputStream Seek not supported");
@@ -201,6 +204,7 @@ public override long Seek(long offset, SeekOrigin origin)
201204
/// <summary>
202205
/// Sets the length of this stream to the given value.
203206
/// </summary>
207+
/// <param name="value">The new stream length.</param>
204208
public override void SetLength(long value)
205209
{
206210
throw new NotSupportedException("BZip2OutputStream SetLength not supported");
@@ -209,6 +213,7 @@ public override void SetLength(long value)
209213
/// <summary>
210214
/// Read a byte from the stream advancing the position.
211215
/// </summary>
216+
/// <returns>The byte read cast to an int; -1 if end of stream.</returns>
212217
public override int ReadByte()
213218
{
214219
throw new NotSupportedException("BZip2OutputStream ReadByte not supported");
@@ -217,6 +222,12 @@ public override int ReadByte()
217222
/// <summary>
218223
/// Read a block of bytes
219224
/// </summary>
225+
/// <param name="buffer">The buffer to read into.</param>
226+
/// <param name="offset">The offset in the buffer to start storing data at.</param>
227+
/// <param name="count">The maximum number of bytes to read.</param>
228+
/// <returns>The total number of bytes read. This might be less than the number of bytes
229+
/// requested if that number of bytes are not currently available, or zero
230+
/// if the end of the stream is reached.</returns>
220231
public override int Read(byte[] buffer, int offset, int count)
221232
{
222233
throw new NotSupportedException("BZip2OutputStream Read not supported");
@@ -225,6 +236,9 @@ public override int Read(byte[] buffer, int offset, int count)
225236
/// <summary>
226237
/// Write a block of bytes to the stream
227238
/// </summary>
239+
/// <param name="buffer">The buffer containing data to write.</param>
240+
/// <param name="offset">The offset of the first byte to write.</param>
241+
/// <param name="count">The number of bytes to write.</param>
228242
public override void Write(byte[] buffer, int offset, int count)
229243
{
230244
if ( buffer == null ) {
@@ -254,6 +268,7 @@ public override void Write(byte[] buffer, int offset, int count)
254268
/// <summary>
255269
/// Write a byte to the stream.
256270
/// </summary>
271+
/// <param name="value">The byte to write to the stream.</param>
257272
public override void WriteByte(byte value)
258273
{
259274
int b = (256 + value) % 256;

src/Encryption/PkzipClassic.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public abstract class PkzipClassic : SymmetricAlgorithm
5555
/// Generates new encryption keys based on given seed
5656
/// </summary>
5757
/// <param name="seed">The seed value to initialise keys with.</param>
58+
/// <returns>A new key value.</returns>
5859
static public byte[] GenerateKeys(byte[] seed)
5960
{
6061
if ( seed == null )
@@ -68,10 +69,10 @@ static public byte[] GenerateKeys(byte[] seed)
6869
}
6970

7071
uint[] newKeys = new uint[] {
71-
0x12345678,
72-
0x23456789,
73-
0x34567890
74-
};
72+
0x12345678,
73+
0x23456789,
74+
0x34567890
75+
};
7576

7677
for (int i = 0; i < seed.Length; ++i)
7778
{

src/Tar/TarBuffer.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ or which contains garbage records after a zero block.
103103
/// <summary>
104104
/// Get the record size for this buffer
105105
/// </summary>
106+
/// <value>The record size in bytes.
107+
/// This is equal to the <see cref="BlockFactor"/> multiplied by the <see cref="BlockSize"/></value>
106108
public int RecordSize
107109
{
108110
get {
@@ -113,6 +115,8 @@ public int RecordSize
113115
/// <summary>
114116
/// Get the TAR Buffer's record size.
115117
/// </summary>
118+
/// <returns>The record size in bytes.
119+
/// This is equal to the <see cref="BlockFactor"/> multiplied by the <see cref="BlockSize"/></returns>
116120
[Obsolete("Use RecordSize property instead")]
117121
public int GetRecordSize()
118122
{
@@ -122,6 +126,7 @@ public int GetRecordSize()
122126
/// <summary>
123127
/// Get the Blocking factor for the buffer
124128
/// </summary>
129+
/// <value>This is the number of block in each record.</value>
125130
public int BlockFactor {
126131
get {
127132
return blockFactor;
@@ -131,6 +136,7 @@ public int BlockFactor {
131136
/// <summary>
132137
/// Get the TAR Buffer's block factor
133138
/// </summary>
139+
/// <returns>The block factor; the number of blocks per record.</returns>
134140
[Obsolete("Use BlockFactor property instead")]
135141
public int GetBlockFactor()
136142
{
@@ -148,7 +154,7 @@ protected TarBuffer()
148154
/// Create TarBuffer for reading with default BlockFactor
149155
/// </summary>
150156
/// <param name="inputStream">Stream to buffer</param>
151-
/// <returns>TarBuffer</returns>
157+
/// <returns>A new <see cref="TarBuffer"/> suitable for input.</returns>
152158
public static TarBuffer CreateInputTarBuffer(Stream inputStream)
153159
{
154160
if ( inputStream == null )
@@ -164,7 +170,7 @@ public static TarBuffer CreateInputTarBuffer(Stream inputStream)
164170
/// </summary>
165171
/// <param name="inputStream">Stream to buffer</param>
166172
/// <param name="blockFactor">Blocking factor to apply</param>
167-
/// <returns>TarBuffer</returns>
173+
/// <returns>A new <see cref="TarBuffer"/> suitable for input.</returns>
168174
public static TarBuffer CreateInputTarBuffer(Stream inputStream, int blockFactor)
169175
{
170176
if ( inputStream == null )
@@ -193,7 +199,7 @@ public static TarBuffer CreateInputTarBuffer(Stream inputStream, int blockFactor
193199
/// Construct TarBuffer for writing with default BlockFactor
194200
/// </summary>
195201
/// <param name="outputStream">output stream for buffer</param>
196-
/// <returns>TarBuffer</returns>
202+
/// <returns>A new <see cref="TarBuffer"/> suitable for output.</returns>
197203
public static TarBuffer CreateOutputTarBuffer(Stream outputStream)
198204
{
199205
if ( outputStream == null )
@@ -209,7 +215,7 @@ public static TarBuffer CreateOutputTarBuffer(Stream outputStream)
209215
/// </summary>
210216
/// <param name="outputStream">Output stream to write to.</param>
211217
/// <param name="blockFactor">Blocking factor to apply</param>
212-
/// <returns>TarBuffer</returns>
218+
/// <returns>A new <see cref="TarBuffer"/> suitable for output.</returns>
213219
public static TarBuffer CreateOutputTarBuffer(Stream outputStream, int blockFactor)
214220
{
215221
if ( outputStream == null )
@@ -263,6 +269,7 @@ void Initialize(int blockFactor)
263269
/// and also partial records
264270
/// </summary>
265271
/// <param name = "block">The data block to check.</param>
272+
/// <returns>Returns true if the block is an EOF block; false otherwise.</returns>
266273
public bool IsEOFBlock(byte[] block)
267274
{
268275
if ( block == null ) {

src/Tar/TarEntry.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ public object Clone()
124124
/// Construct an entry with only a <paramref name="name">name</paramref>.
125125
/// This allows the programmer to construct the entry's header "by hand".
126126
/// </summary>
127+
/// <param name="name">The name to use for the entry</param>
128+
/// <returns>Returns the newly created <see cref="TarEntry"/></returns>
127129
public static TarEntry CreateTarEntry(string name)
128130
{
129131
TarEntry entry = new TarEntry();
@@ -135,9 +137,8 @@ public static TarEntry CreateTarEntry(string name)
135137
/// Construct an entry for a file. File is set to file, and the
136138
/// header is constructed from information from the file.
137139
/// </summary>
138-
/// <param name = "fileName">
139-
/// The file that the entry represents.
140-
/// </param>
140+
/// <param name = "fileName">The file name that the entry represents.</param>
141+
/// <returns>Returns the newly created <see cref="TarEntry"/></returns>
141142
public static TarEntry CreateEntryFromFile(string fileName)
142143
{
143144
TarEntry entry = new TarEntry();
@@ -149,8 +150,9 @@ public static TarEntry CreateEntryFromFile(string fileName)
149150
/// Determine if the two entries are equal. Equality is determined
150151
/// by the header names being equal.
151152
/// </summary>
153+
/// <param name="obj">The <see cref="Object"/> to compare with the current Object.</param>
152154
/// <returns>
153-
/// True if the entries are equal.
155+
/// True if the entries are equal; false if not.
154156
/// </returns>
155157
public override bool Equals(object obj)
156158
{
@@ -164,8 +166,9 @@ public override bool Equals(object obj)
164166
}
165167

166168
/// <summary>
167-
/// Must be overridden when you override Equals.
169+
/// Derive a Hash value for the current <see cref="Object"/>
168170
/// </summary>
171+
/// <returns>A Hash code for the current <see cref="Object"/></returns>
169172
public override int GetHashCode()
170173
{
171174
return Name.GetHashCode();

src/Tar/TarHeader.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
/* The tar format and its POSIX successor PAX have a long history which makes for compatability
3838
issues when creating and reading files.
39-
39+
4040
This is further complicated by a large number of programs with variations on formats
4141
One common issue is the handling of names longer than 100 characters.
4242
GNU style long names are currently supported.
@@ -547,8 +547,9 @@ public int DevMinor
547547

548548
#region ICloneable Members
549549
/// <summary>
550-
/// Clone a TAR header.
550+
/// Create a new <see cref="TarHeader"/> that is a copy of the current instance.
551551
/// </summary>
552+
/// <returns>A new <see cref="Object"/> that is a copy of the current instance.</returns>
552553
public object Clone()
553554
{
554555
return this.MemberwiseClone();
@@ -963,10 +964,10 @@ public static int GetAsciiBytes(string toAdd, int nameOffset, byte[] buffer, int
963964
}
964965

965966
for (int i = 0 ; i < length && nameOffset + i < toAdd.Length; ++i)
966-
{
967+
{
967968
buffer[bufferOffset + i] = (byte)toAdd[nameOffset + i];
968-
}
969-
return bufferOffset + length;
969+
}
970+
return bufferOffset + length;
970971
}
971972

972973
/// <summary>

src/Tar/TarInputStream.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ public override void Flush()
136136
/// <summary>
137137
/// Set the streams position. This operation is not supported and will throw a NotSupportedException
138138
/// </summary>
139+
/// <param name="offset">The offset relative to the origin to seek to.</param>
140+
/// <param name="origin">The <see cref="SeekOrigin"/> to start seeking from.</param>
141+
/// <returns>The new position in the stream.</returns>
139142
/// <exception cref="NotSupportedException">Any access</exception>
140143
public override long Seek(long offset, SeekOrigin origin)
141144
{
@@ -146,6 +149,7 @@ public override long Seek(long offset, SeekOrigin origin)
146149
/// Sets the length of the stream
147150
/// This operation is not supported and will throw a NotSupportedException
148151
/// </summary>
152+
/// <param name="value">The new stream length.</param>
149153
/// <exception cref="NotSupportedException">Any access</exception>
150154
public override void SetLength(long value)
151155
{
@@ -156,6 +160,9 @@ public override void SetLength(long value)
156160
/// Writes a block of bytes to this stream using data from a buffer.
157161
/// This operation is not supported and will throw a NotSupportedException
158162
/// </summary>
163+
/// <param name="buffer">The buffer containing bytes to write.</param>
164+
/// <param name="offset">The offset in the buffer of the frist byte to write.</param>
165+
/// <param name="count">The number of bytes to write.</param>
159166
/// <exception cref="NotSupportedException">Any access</exception>
160167
public override void Write(byte[] buffer, int offset, int count)
161168
{
@@ -166,15 +173,16 @@ public override void Write(byte[] buffer, int offset, int count)
166173
/// Writes a byte to the current position in the file stream.
167174
/// This operation is not supported and will throw a NotSupportedException
168175
/// </summary>
176+
/// <param name="value">The byte value to write.</param>
169177
/// <exception cref="NotSupportedException">Any access</exception>
170178
public override void WriteByte(byte value)
171179
{
172180
throw new NotSupportedException("TarInputStream WriteByte not supported");
173181
}
174182
/// <summary>
175183
/// Reads a byte from the current tar archive entry.
176-
/// This method simply calls Read(byte[], int, int).
177184
/// </summary>
185+
/// <returns>A byte cast to an int; -1 if the at the end of the stream.</returns>
178186
public override int ReadByte()
179187
{
180188
byte[] oneByteBuffer = new byte[1];
@@ -473,8 +481,8 @@ public TarEntry GetNextEntry()
473481
SkipToNextEntry();
474482
headerBuf = this.buffer.ReadBlock();
475483
} else if (header.TypeFlag != TarHeader.LF_NORMAL &&
476-
header.TypeFlag != TarHeader.LF_OLDNORM &&
477-
header.TypeFlag != TarHeader.LF_DIR) {
484+
header.TypeFlag != TarHeader.LF_OLDNORM &&
485+
header.TypeFlag != TarHeader.LF_DIR) {
478486
// Ignore things we dont understand completely for now
479487
SkipToNextEntry();
480488
headerBuf = this.buffer.ReadBlock();
@@ -588,6 +596,7 @@ public class EntryFactoryAdapter : IEntryFactory
588596
/// Create a <see cref="TarEntry"/> based on named
589597
/// </summary>
590598
/// <param name="name">The name to use for the entry</param>
599+
/// <returns>A new <see cref="TarEntry"/></returns>
591600
public TarEntry CreateEntry(string name)
592601
{
593602
return TarEntry.CreateTarEntry(name);
@@ -597,6 +606,7 @@ public TarEntry CreateEntry(string name)
597606
/// Create a tar entry with details obtained from <paramref name="fileName">file</paramref>
598607
/// </summary>
599608
/// <param name="fileName">The name of the file to retrieve details from.</param>
609+
/// <returns>A new <see cref="TarEntry"/></returns>
600610
public TarEntry CreateEntryFromFile(string fileName)
601611
{
602612
return TarEntry.CreateEntryFromFile(fileName);
@@ -606,13 +616,13 @@ public TarEntry CreateEntryFromFile(string fileName)
606616
/// Create an entry based on details in <paramref name="headerBuf">header</paramref>
607617
/// </summary>
608618
/// <param name="headerBuffer">The buffer containing entry details.</param>
619+
/// <returns>A new <see cref="TarEntry"/></returns>
609620
public TarEntry CreateEntry(byte[] headerBuffer)
610621
{
611622
return new TarEntry(headerBuffer);
612623
}
613624
}
614625

615-
616626
#region Instance Fields
617627
/// <summary>
618628
/// Flag set when last block has been read

src/Tar/TarOutputStream.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,18 @@ public override long Position
141141
/// <summary>
142142
/// set the position within the current stream
143143
/// </summary>
144+
/// <param name="offset">The offset relative to the <paramref name="origin"/> to seek to</param>
145+
/// <param name="origin">The <see cref="SeekOrigin"/> to seek from.</param>
146+
/// <returns>The new position in the stream.</returns>
144147
public override long Seek(long offset, SeekOrigin origin)
145148
{
146149
return outputStream.Seek(offset, origin);
147150
}
148151

149152
/// <summary>
150-
/// set the length of the current stream
153+
/// Set the length of the current stream
151154
/// </summary>
155+
/// <param name="value">The new stream length.</param>
152156
public override void SetLength(long value)
153157
{
154158
outputStream.SetLength(value);
@@ -168,7 +172,12 @@ public override int ReadByte()
168172
/// read bytes from the current stream and advance the position within the
169173
/// stream by the number of bytes read.
170174
/// </summary>
171-
/// <returns>The total number of bytes read, or zero if at the end of the stream</returns>
175+
/// <param name="buffer">The buffer to store read bytes in.</param>
176+
/// <param name="offset">The index into the buffer to being storing bytes at.</param>
177+
/// <param name="count">The desired number of bytes to read.</param>
178+
/// <returns>The total number of bytes read, or zero if at the end of the stream.
179+
/// The number of bytes may be less than the <paramref name="count">count</paramref>
180+
/// requested if data is not avialable.</returns>
172181
public override int Read(byte[] buffer, int offset, int count)
173182
{
174183
return outputStream.Read(buffer, offset, count);
@@ -313,7 +322,7 @@ public void CloseEntry()
313322
if (currBytes < currSize) {
314323
string errorText = string.Format(
315324
"Entry closed at '{0}' before the '{1}' bytes specified in the header were written",
316-
currBytes, currSize);
325+
currBytes, currSize);
317326
throw new TarException(errorText);
318327
}
319328
}

0 commit comments

Comments
 (0)