Commit dce096be authored by Boaz Brickner's avatar Boaz Brickner
parents 25075445 c8a951a8
...@@ -23,15 +23,7 @@ namespace PcapDotNet.Packets ...@@ -23,15 +23,7 @@ namespace PcapDotNet.Packets
/// Take all the bytes as a segment. /// Take all the bytes as a segment.
/// </summary> /// </summary>
/// <param name="buffer">The buffer to take as a segment.</param> /// <param name="buffer">The buffer to take as a segment.</param>
public DataSegment(byte[] buffer) public DataSegment(byte[] buffer) : this(buffer, 0 , buffer == null ? 0 : buffer.Length) {}
{
if (buffer == null)
throw new ArgumentNullException("buffer");
Buffer = buffer;
StartOffset = 0;
Length = buffer.Length;
}
/// <summary> /// <summary>
/// Take only part of the bytes as a segment. /// Take only part of the bytes as a segment.
...@@ -41,6 +33,9 @@ namespace PcapDotNet.Packets ...@@ -41,6 +33,9 @@ namespace PcapDotNet.Packets
/// <param name="length">The number of bytes to take.</param> /// <param name="length">The number of bytes to take.</param>
public DataSegment(byte[] buffer, int offset, int length) public DataSegment(byte[] buffer, int offset, int length)
{ {
if (buffer == null)
throw new ArgumentNullException("buffer");
Buffer = buffer; Buffer = buffer;
StartOffset = offset; StartOffset = offset;
Length = length; Length = length;
...@@ -408,4 +403,4 @@ namespace PcapDotNet.Packets ...@@ -408,4 +403,4 @@ namespace PcapDotNet.Packets
private static readonly DataSegment _empty = new DataSegment(new byte[0]); private static readonly DataSegment _empty = new DataSegment(new byte[0]);
} }
} }
\ No newline at end of file
...@@ -40,3 +40,5 @@ Not including: ...@@ -40,3 +40,5 @@ Not including:
[![Follow Pcap.Net on Google+](https://ssl.gstatic.com/images/icons/gplus-32.png)](https://plus.google.com/111766834267147414574) [Follow Pcap.Net on Google+](https://plus.google.com/111766834267147414574) [![Follow Pcap.Net on Google+](https://ssl.gstatic.com/images/icons/gplus-32.png)](https://plus.google.com/111766834267147414574) [Follow Pcap.Net on Google+](https://plus.google.com/111766834267147414574)
<a href='https://pledgie.com/campaigns/28716'><img alt='Click here to lend your support to: Pcap.Net and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/28716.png?skin_name=chrome' border='0' ></a> <a href='https://pledgie.com/campaigns/28716'><img alt='Click here to lend your support to: Pcap.Net and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/28716.png?skin_name=chrome' border='0' ></a>
<a href='https://salt.bountysource.com/teams/pcapdotnet'>Support Pcap.Net using Salt</a>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment