Class InstrumentProfileReader
Reads instrument profiles from the stream using Instrument Profile Format (IPF).
Please see <b>Instrument Profile Format</b> documentation for complete description.
This reader automatically uses data formats as specified in the stream.
<p></p>
This reader is intended for "one time only" usage: create new instances for new IPF reads.
<p></p>
Use InstrumentProfileConnection if support for streaming updates of instrument profiles is needed.
<p></p>
For backward compatibility reader can be configured with system property "com.dxfeed.ipf.complete" to control the strategy for missing "##COMPLETE" tag when reading IPF, possible values are:
<ul>
<li><code>warn</code> - show warning in the log (default)</li>
<li><code>error</code> - throw exception (future default)</li>
<li><code>ignore</code> - do nothing (for backward compatibility)</li>
</ul>
public class InstrumentProfileReader
- Inheritance
-
InstrumentProfileReader
- Inherited Members
Methods
GetLastModified()
Gets last modification time (in milliseconds) from last ReadFromFile(string) operation or zero if it is unknown.
public long GetLastModified()
Returns
- long
The last modification time.
ReadFromFile(string)
Reads and returns instrument profiles from specified file.
This method recognizes data compression formats "zip" and "gzip" automatically.
In case of <em>zip</em> the first file entry will be read and parsed as a plain data stream.
In case of <em>gzip</em> compressed content will be read and processed.
In other cases data considered uncompressed and will be parsed as is.
<p></p>
Authentication information can be supplied to this method as part of URL user info
like "http://user:password@host:port/path/file.ipf".
<p></p>
This operation updates GetLastModified() and WasComplete().
public List<InstrumentProfile> ReadFromFile(string address)
Parameters
addressstringThe URL of file to read from.
Returns
- List<InstrumentProfile>
The list of instrument profiles.
ReadFromFile(string, AuthToken?)
Reads and returns instrument profiles from specified address with a specified token credentials.
This method recognizes data compression formats "zip" and "gzip" automatically.
In case of <em>zip</em> the first file entry will be read and parsed as a plain data stream.
In case of <em>gzip</em> compressed content will be read and processed.
In other cases data considered uncompressed and will be parsed as is.
<p></p>
Specified token take precedence over authentication information that is supplied to this method
as part of URL user info like "http://user:password@host:port/path/file.ipf".
<p></p>
This operation updates GetLastModified() and WasComplete().
public List<InstrumentProfile> ReadFromFile(string address, AuthToken? token)
Parameters
Returns
- List<InstrumentProfile>
The list of instrument profiles.
ReadFromFile(string, string?, string?)
Reads and returns instrument profiles from specified file.
This method recognizes data compression formats "zip" and "gzip" automatically.
In case of <em>zip</em> the first file entry will be read and parsed as a plain data stream.
In case of <em>gzip</em> compressed content will be read and processed.
In other cases data considered uncompressed and will be parsed as is.
<p></p>
Specified user and password take precedence over authentication information that is supplied to this method
as part of URL user info like "http://user:password@host:port/path/file.ipf".
<p></p>
This operation updates GetLastModified() and WasComplete().
public List<InstrumentProfile> ReadFromFile(string address, string? user, string? password)
Parameters
addressstringThe URL of file to read from.
userstringThe username (maybe null).
passwordstringThe password (maybe null).
Returns
- List<InstrumentProfile>
The list of instrument profiles.
ResolveSourceUrl(string)
Resolves the given address specification into its corresponding URL format, particularly transforming simple "host:port" address specifications into a full HTTP URL.
public static string? ResolveSourceUrl(string address)
Parameters
addressstringThe address specification to be resolved into a URL.
Returns
- string
The resolved URL corresponding to the specified address.
Remarks
If the provided address appears to be a "host:port" pattern without any forward slashes, this method will attempt to convert it to a standardized HTTP URL format targeting an "ipf/all.ipf.gz" endpoint. If the address contains a query parameter (e.g., "host:port?param=value"), the parameter will be preserved in the resulting URL. Addresses that do not fit the "host:port" pattern, or that have invalid port numbers, are returned unchanged.
WasComplete()
Returns true if IPF was fully read on last ReadFromFile(string) operation.
public bool WasComplete()
Returns
- bool
trueif IPF was fully read; otherwise,false.