Difference between revisions of "API:BinaryReader"
From Kerbal Space Program Wiki
m (N3X15 moved page BinaryReader to API:BinaryReader: API namespace) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <!-- Autogenerated by DOCTOOL. Yell at N3X15 if it breaks. --> | ||
{{Namespace:KSP.IO}} | {{Namespace:KSP.IO}} | ||
{{Class | {{Class | ||
Line 4: | Line 5: | ||
|summary=Identical to System.IO.BinaryReader, but with added IDisposable methods (for use in using structures), and a factory method instead of constructors. | |summary=Identical to System.IO.BinaryReader, but with added IDisposable methods (for use in using structures), and a factory method instead of constructors. | ||
}} | }} | ||
+ | {{PropertiesStart}} | ||
+ | {{Property | ||
+ | |type=Stream | ||
+ | |name=BaseStream | ||
+ | |desc=Grab the underlying Stream. | ||
+ | |hasget=1 | ||
+ | |hasset= | ||
+ | }} | ||
+ | {{PropertiesEnd}} | ||
{{MethodsStart}} | {{MethodsStart}} | ||
{{StaticMethod | {{StaticMethod | ||
|returntype=BinaryReader | |returntype=BinaryReader | ||
− | |returndesc= | + | |returndesc= |
|name=CreateForType<T> | |name=CreateForType<T> | ||
− | |args=string filename, Vessel flight = null | + | |args={{arg|string|filename|desc=The file to open}}, {{arg|Vessel|flight|default=null|desc=The current Flight object}} |
|desc=Create a binary reader with the desired filename. | |desc=Create a binary reader with the desired filename. | ||
}} | }} | ||
Line 79: | Line 89: | ||
|returndesc= | |returndesc= | ||
|name=Read | |name=Read | ||
− | |args=char[] | + | |args={{arg|char|buffer|array=[]}}, {{arg|int|index}}, {{arg|int|count}} |
− | |desc= | + | |desc=Read a block of {{type|char}}s from the stream. |
}} | }} | ||
{{Method | {{Method | ||
Line 100: | Line 110: | ||
|returndesc= | |returndesc= | ||
|name=Read | |name=Read | ||
− | |args=byte[] | + | |args={{arg|byte|buffer|array=[]}}, {{arg|int|index}}, {{arg|int|count}} |
− | |desc= | + | |desc=Read a block of {{type|byte}}s from the stream. |
}} | }} | ||
{{Method | {{Method | ||
Line 118: | Line 128: | ||
}} | }} | ||
{{Method | {{Method | ||
− | |returntype=char[] | + | |returntype=char |
+ | |array=[] | ||
|returndesc= | |returndesc= | ||
|name=ReadChars | |name=ReadChars | ||
− | |args=int count | + | |args={{arg|int|count}} |
|desc= | |desc= | ||
}} | }} | ||
Line 153: | Line 164: | ||
}} | }} | ||
{{Method | {{Method | ||
− | |returntype=byte[] | + | |returntype=byte |
+ | |array=[] | ||
|returndesc= | |returndesc= | ||
|name=ReadBytes | |name=ReadBytes | ||
− | |args=int count | + | |args={{arg|int|count}} |
|desc= | |desc= | ||
}} | }} | ||
Line 164: | Line 176: | ||
|name=Dispose | |name=Dispose | ||
|args= | |args= | ||
− | |desc= | + | |desc=Close the stream and any resources (e.g. files) it has open. |
}} | }} | ||
{{MethodsEnd}} | {{MethodsEnd}} |
Latest revision as of 09:47, 14 October 2012
KSP.IO Namespace
BinaryReader ·
BinaryWriter ·
File ·
FileInfo ·
FileStream ·
IOException ·
IOTools ·
IOUtils ·
MemoryStream ·
PluginConfigNode ·
PluginConfiguration ·
TextReader ·
TextWriter
BinaryReader Class
Identical to System.IO.BinaryReader, but with added IDisposable methods (for use in using structures), and a factory method instead of constructors.
Properties
The following are public properties available in BinaryReader.
Signature | Description |
---|---|
Stream BaseStream { get; } | Grab the underlying Stream. |
Methods
The following are methods included in BinaryReader.
Signature | Description |
---|---|
static BinaryReader CreateForType<T>(string filename, Vessel flight = null) | Create a binary reader with the desired filename. |
short ReadInt16() | |
int Read() | |
float ReadSingle() | |
void Close() | |
uint ReadUInt32() | |
double ReadDouble() | |
long ReadInt64() | |
string ReadString() | |
int PeekChar() | |
int Read(char[] buffer, int index, int count) | Read a block of chars from the stream. |
char ReadChar() | |
bool ReadBoolean() | |
int Read(byte[] buffer, int index, int count) | Read a block of bytes from the stream. |
byte ReadByte() | |
ushort ReadUInt16() | |
char[] ReadChars(int count) | |
sbyte ReadSByte() | |
ulong ReadUInt64() | |
int ReadInt32() | |
decimal ReadDecimal() | |
byte[] ReadBytes(int count) | |
void Dispose() | Close the stream and any resources (e.g. files) it has open. |