private static void writeByteRange(TagWriter tagWriter, ByteRange byteRange)
        {
            String value;

            if (byteRange.getOffset() != null)
            {
                value = byteRange.getSubRangeLength().ToString()
                        + '@' + byteRange.getOffset().ToString();
            }
            else
            {
                value = byteRange.getSubRangeLength().ToString();
            }

            tagWriter.writeTag(Constants.EXT_X_BYTERANGE_TAG, value);
        }
Example #2
0
        public void testEXT_X_BYTERANGE()
        {
            IExtTagParser handler        = MediaPlaylistLineParser.EXT_X_BYTERANGE;
            String        tag            = Constants.EXT_X_BYTERANGE_TAG;
            long          subRangeLength = 350;
            long          offset         = 70L;

            String line = "#" + tag + ":" + subRangeLength + "@" + offset;

            Assert.Equal(tag, handler.getTag());
            handler.parse(line, mParseState);
            ByteRange byteRange = mParseState.getMedia().byteRange;

            Assert.Equal(subRangeLength, byteRange.getSubRangeLength());
            Assert.Equal(offset, byteRange.getOffset());
        }
                public String write(MapInfo attributes)
                {
                    ByteRange byteRange = attributes.getByteRange();
                    String    value;

                    if (byteRange.hasOffset())
                    {
                        value = byteRange.getSubRangeLength().ToString()
                                + '@' + byteRange.getOffset().ToString();
                    }
                    else
                    {
                        value = byteRange.getSubRangeLength().ToString();
                    }

                    return(WriteUtil.writeQuotedString(value));
                }