public class InstrumentProfileReader extends Object
This reader is intended for "one time only" usage: create new instances for new IPF reads.
Use InstrumentProfileConnection
if support for streaming updates of instrument profiles is needed.
For backward compatibility reader can be configured with system property "-Dcom.dxfeed.ipf.complete" to control the strategy for missing "##COMPLETE" tag when reading IPF, possible values are:
warn
- show warning in the log (default)error
- throw exception (future default)ignore
- do nothing (for backward compatibility)Modifier and Type | Field and Description |
---|---|
protected boolean |
wasComplete |
Constructor and Description |
---|
InstrumentProfileReader()
Creates instrument profile reader.
|
Modifier and Type | Method and Description |
---|---|
long |
getLastModified()
Returns last modification time (in milliseconds) from last
readFromFile(java.lang.String) operation
or zero if it is unknown. |
protected void |
handleIncomplete(String address) |
protected String |
intern(String value)
To be overridden in subclasses to allow
intern strings using pools
(like StringCache ) to reduce memory footprint. |
List<InstrumentProfile> |
read(InputStream in)
Deprecated.
Use
read(InputStream, String) .
This is an extension point only and will be made protected in future. |
List<InstrumentProfile> |
read(InputStream in,
String address)
Reads and returns instrument profiles from specified stream
This method recognizes data compression formats "zip" and "gzip" automatically.
|
List<InstrumentProfile> |
readCompressed(InputStream in)
Deprecated.
|
List<InstrumentProfile> |
readFromFile(String address)
Reads and returns instrument profiles from specified file.
|
List<InstrumentProfile> |
readFromFile(String address,
String user,
String password)
Reads and returns instrument profiles from specified address with a specified basic user and password
credentials.
|
static String |
resolveSourceURL(String address)
Converts a specified string address specification into an URL that will be read by
readFromFile(java.lang.String) method using URLInputStream . |
boolean |
wasComplete()
Returns
true if IPF was fully read on last readFromFile(java.lang.String) operation. |
public InstrumentProfileReader()
public long getLastModified()
readFromFile(java.lang.String)
operation
or zero if it is unknown.public boolean wasComplete()
true
if IPF was fully read on last readFromFile(java.lang.String)
operation.public List<InstrumentProfile> readFromFile(String address) throws IOException
Authentication information can be supplied to this method as part of URL user info
like "http://user:password@host:port/path/file.ipf"
.
This is a shortcut for
.
readFromFile
(address, null, null)
This operation updates lastModified
and wasComplete
.
address
- URL of file to read fromInstrumentProfileFormatException
- if input stream does not conform to the Instrument Profile FormatIOException
- If an I/O error occurspublic List<InstrumentProfile> readFromFile(String address, String user, String password) throws IOException
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"
.
This operation updates lastModified
and wasComplete
.
address
- URL of file to read fromuser
- the user name (may be null)password
- the password (may be null)InstrumentProfileFormatException
- if input stream does not conform to the Instrument Profile FormatIOException
- If an I/O error occurspublic static String resolveSourceURL(String address)
readFromFile(java.lang.String)
method using URLInputStream
.public final List<InstrumentProfile> read(InputStream in, String address) throws IOException
This operation updates wasComplete
flag.
in
- InputStream to read profiles fromaddress
- origin of the stream for debugging purposesInstrumentProfileFormatException
- if input stream does not conform to the Instrument Profile FormatIOException
- If an I/O error occurs@Deprecated public final List<InstrumentProfile> readCompressed(InputStream in) throws IOException
read(InputStream, String)
InstrumentProfileFormatException
- if input stream does not conform to the Instrument Profile FormatIOException
- If an I/O error occurs@Deprecated public List<InstrumentProfile> read(InputStream in) throws IOException
read(InputStream, String)
.
This is an extension point only and will be made protected in future.InstrumentProfileFormatException
- if input stream does not conform to the Instrument Profile FormatIOException
- If an I/O error occursprotected String intern(String value)
intern
strings using pools
(like StringCache
) to reduce memory footprint. Default implementation
does nothing (returns value itself).value
- string value to internprotected void handleIncomplete(String address) throws InstrumentProfileFormatException
InstrumentProfileFormatException
Copyright © 2002–2023 Devexperts LLC. All rights reserved.