C# 클래스 SharpOS.Kernel.Foundation.BinaryTool

파일 보기 프로젝트 열기: sharpos/SharpOS

공개 메소드들

메소드 설명
Read7BitInt ( void ptr, int ret_len ) : int
ReadPrefixedString ( void ptr, byte buffer, int bufferLen ) : int
ReadPrefixedString ( void ptr, byte buffer, int bufferLen, int error ) : int

Reads a length-prefixed string as generated by a .NET BinaryReader class. This involves first reading a variable-size 7-bit integer, then the string, placing it in the provided buffer. If the buffer is not large enough, the 'error' parameter is set to 1. The string is still readable in 'buffer', but it is shortened. To prevent this, you can call Read7BitEncodedInt first and size the buffer appropriately. Returns the amount of bytes that the length-prefixed string took up (including the bytes that contained the length), so it can be skipped when reading more data. The 'buffer' will be null-terminated, even if it is too small. The returned value is not reduced if the buffer is too small (IE, it represents the entire string, not the shortened version).

메소드 상세

Read7BitInt() 공개 정적인 메소드

public static Read7BitInt ( void ptr, int ret_len ) : int
ptr void
ret_len int
리턴 int

ReadPrefixedString() 공개 정적인 메소드

public static ReadPrefixedString ( void ptr, byte buffer, int bufferLen ) : int
ptr void
buffer byte
bufferLen int
리턴 int

ReadPrefixedString() 공개 정적인 메소드

Reads a length-prefixed string as generated by a .NET BinaryReader class. This involves first reading a variable-size 7-bit integer, then the string, placing it in the provided buffer. If the buffer is not large enough, the 'error' parameter is set to 1. The string is still readable in 'buffer', but it is shortened. To prevent this, you can call Read7BitEncodedInt first and size the buffer appropriately. Returns the amount of bytes that the length-prefixed string took up (including the bytes that contained the length), so it can be skipped when reading more data. The 'buffer' will be null-terminated, even if it is too small. The returned value is not reduced if the buffer is too small (IE, it represents the entire string, not the shortened version).
public static ReadPrefixedString ( void ptr, byte buffer, int bufferLen, int error ) : int
ptr void
buffer byte
bufferLen int
error int
리턴 int