Chunk - Grade-A-Software/Comcast-DASH-VLC GitHub Wiki

###The chunk datatype is a container object for a segment of data to be downloaded. It has representations of:

  • A sequence of bytes that make up a part of a media file (start and end bytes, length of byte segment, bitrate)
  • Information for the host server that the media segment is downloaded from (host name and address, path to the file, port of access, file url)
  • Download tracking information (percent of segment downloaded, pointer to the connection downloading it)

####Methods These methods are all getters and setters for local values:

  • getEndByte() - Numbered byte that download ended at/will end at.
  • setEndByte()
  • getStartByte() - Numbered byte that download began/will begin from.
  • setStartByte()
  • getUrl() - URL of file to be downloaded from.
  • setUrl()
  • getBitrate() - Integer representing bitrate of current connection.
  • setBitrate()
  • getLength() - How long all the data represented by this chunk is.
  • setLength()
  • getBytesRead() - How many bytes have been downloaded so far.
  • setBytesRead()
  • getConnection() - An IHTTPConnection object pointer (to the connection that is downloading into this chunk).
  • setConnection()
  • getHostName() - String containing the host server name.
  • getPort() - Port that the host server is accessed through.
  • getPath() - Path on the host server to the file desired.

These methods provide quick reference to some other pieces of information which can be easily calculated from local variables.

  • getBytestoRead() - subtracts length of bytes read so far by chunk length to return how many bytes remain to be downloaded.
  • getPercentDownloaded() - divides bytesRead by length to return a 0-100 float representing percentage of bytes downloaded so far.