Created
November 23, 2010 05:44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SkipObject(Stream stream) | |
{ | |
var reader = new BinaryReader(stream); | |
stream.Position += reader.ReadInt32(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SkipObject(Stream stream) | |
{ | |
var reader = new BinaryReader(stream); | |
// The problem here is that we first get the current position | |
// from the stream, then we read our int (moving the stream | |
// forward 4 bytes), then sum the position and the int, but the | |
// position value we read initially is now out of date so we wind | |
// up being 4 bytes away from where we expected. | |
stream.Position = stream.Position + reader.ReadInt32(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void SkipObject(Stream stream) | |
{ | |
var reader = new BinaryReader(stream); | |
var objectSize = reader.ReadInt32(); | |
stream.Position += objectSize; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment