com.dxfeed.ipf
Class InstrumentProfileReader

java.lang.Object
  extended by com.dxfeed.ipf.InstrumentProfileReader

public class InstrumentProfileReader
extends Object

Reads instrument profiles from the stream using Simple File Format. Please see Instrument Profile Format documentation for complete description.

This reader automatically uses data formats as specified in the stream.


Nested Class Summary
protected static class InstrumentProfileReader.UncloseableInputStream
          Delegating InputStream that does not close underlying stream.
 
Constructor Summary
InstrumentProfileReader()
           
 
Method Summary
 long getLastModified()
          Returns last modification time (in milliseconds) from last readFromFile(java.lang.String) operation or zero if it is unknown.
 List<InstrumentProfile> read(InputStream in)
          Reads and returns instrument profiles from specified stream.
 List<InstrumentProfile> read(InputStream in, String name)
          Reads and returns instrument profiles from specified stream using specified name to select data compression format.
 List<InstrumentProfile> readFromFile(String address)
          Reads and returns instrument profiles from specified file.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstrumentProfileReader

public InstrumentProfileReader()
Method Detail

getLastModified

public long getLastModified()
Returns last modification time (in milliseconds) from last readFromFile(java.lang.String) operation or zero if it is unknown.


readFromFile

public List<InstrumentProfile> readFromFile(String address)
                                     throws IOException
Reads and returns instrument profiles from specified file. This method recognizes popular data compression formats "zip" and "gzip" by analysing file name. If file name ends with ".zip" then all compressed files will be read independently one by one in their order of appearing and total concatenated list of instrument profiles will be returned. If file name ends with ".gz" then compressed content will be read and returned. In other cases file will be considered uncompressed and will be read as is.

This operation updates lastModified.

Parameters:
address - URL of file to read from
Returns:
list of instrument profiles
Throws:
InstrumentProfileFormatException - if input stream does not conform to the Simple File Format
IOException - If an I/O error occurs

resolveSourceURL

public 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.


read

public List<InstrumentProfile> read(InputStream in,
                                    String name)
                             throws IOException
Reads and returns instrument profiles from specified stream using specified name to select data compression format. This method recognizes popular data compression formats "zip" and "gzip" by analysing file name. If file name ends with ".zip" then all compressed files will be read independently one by one in their order of appearing and total concatenated list of instrument profiles will be returned. If file name ends with ".gz" then compressed content will be read and returned. In other cases file will be considered uncompressed and will be read as is.

Throws:
InstrumentProfileFormatException - if input stream does not conform to the Simple File Format
IOException - If an I/O error occurs

read

public List<InstrumentProfile> read(InputStream in)
                             throws IOException
Reads and returns instrument profiles from specified stream.

Throws:
InstrumentProfileFormatException - if input stream does not conform to the Simple File Format
IOException - If an I/O error occurs


Copyright © 2013 Devexperts. All Rights Reserved.