@Test public void testShortenNameByParts() throws Exception { String fullString = "one:two:three:four:five"; String shortString = videoStreamConstructor.shortenNameByParts(fullString, ":", 2); assertThat(shortString).isEqualTo("four:five"); }
public String shortenNameByParts(String srcString, String matchStr, int groupCount) { if (!StringUtils.isEmpty(matchStr) && !StringUtils.isEmpty(srcString)) { int[] pos = StringParse.getStringPositions(srcString, matchStr); if (groupCount > 0 && pos.length > groupCount) { return srcString.substring(pos[pos.length - groupCount] + 1); } } return srcString; }
VideoStreamConstructor { public String shortenNameByParts(String srcString, String matchStr, int groupCount) { if (!StringUtils.isEmpty(matchStr) && !StringUtils.isEmpty(srcString)) { int[] pos = StringParse.getStringPositions(srcString, matchStr); if (groupCount > 0 && pos.length > groupCount) { return srcString.substring(pos[pos.length - groupCount] + 1); } } return srcString; } }
VideoStreamConstructor { public String shortenNameByParts(String srcString, String matchStr, int groupCount) { if (!StringUtils.isEmpty(matchStr) && !StringUtils.isEmpty(srcString)) { int[] pos = StringParse.getStringPositions(srcString, matchStr); if (groupCount > 0 && pos.length > groupCount) { return srcString.substring(pos[pos.length - groupCount] + 1); } } return srcString; } VideoStreamConstructor(); }
VideoStreamConstructor { public String shortenNameByParts(String srcString, String matchStr, int groupCount) { if (!StringUtils.isEmpty(matchStr) && !StringUtils.isEmpty(srcString)) { int[] pos = StringParse.getStringPositions(srcString, matchStr); if (groupCount > 0 && pos.length > groupCount) { return srcString.substring(pos[pos.length - groupCount] + 1); } } return srcString; } VideoStreamConstructor(); String extractExtensionFromRequest(HttpRequestResponseInfo req); String extractNameFromRRInfo(HttpRequestResponseInfo req); String extractFullNameFromRRInfo(HttpRequestResponseInfo req); void extractVideo(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request, Double timeStamp); void updateVideoNameSize(); String shortenNameByParts(String srcString, String matchStr, int groupCount); String buildSegmentFullPathName(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request); String buildPath(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request, int segmentID, String segmentQuality, String fileName); void collectFromFFMPEG(String fullPath, ChildManifest childManifest, Manifest manifest); ChildManifest locateChildManifestAndSegmentInfo(HttpRequestResponseInfo request, Double timeStamp, ManifestCollection manifestCollection); SegmentInfo nullSegmentInfo(); String buildByteRangeKey(HttpRequestResponseInfo request); Manifest extractManifestHLS(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request); double parseResolution(String lines); boolean savePayload(byte[] content, String pathName); String findPathNameTiebreaker(String pathName); void addFailedRequest(HttpRequestResponseInfo request); Manifest extractManifestDash(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request); ManifestCollection getManifestCollectionMap(); void init(); }
VideoStreamConstructor { public String shortenNameByParts(String srcString, String matchStr, int groupCount) { if (!StringUtils.isEmpty(matchStr) && !StringUtils.isEmpty(srcString)) { int[] pos = StringParse.getStringPositions(srcString, matchStr); if (groupCount > 0 && pos.length > groupCount) { return srcString.substring(pos[pos.length - groupCount] + 1); } } return srcString; } VideoStreamConstructor(); String extractExtensionFromRequest(HttpRequestResponseInfo req); String extractNameFromRRInfo(HttpRequestResponseInfo req); String extractFullNameFromRRInfo(HttpRequestResponseInfo req); void extractVideo(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request, Double timeStamp); void updateVideoNameSize(); String shortenNameByParts(String srcString, String matchStr, int groupCount); String buildSegmentFullPathName(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request); String buildPath(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request, int segmentID, String segmentQuality, String fileName); void collectFromFFMPEG(String fullPath, ChildManifest childManifest, Manifest manifest); ChildManifest locateChildManifestAndSegmentInfo(HttpRequestResponseInfo request, Double timeStamp, ManifestCollection manifestCollection); SegmentInfo nullSegmentInfo(); String buildByteRangeKey(HttpRequestResponseInfo request); Manifest extractManifestHLS(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request); double parseResolution(String lines); boolean savePayload(byte[] content, String pathName); String findPathNameTiebreaker(String pathName); void addFailedRequest(HttpRequestResponseInfo request); Manifest extractManifestDash(StreamingVideoData streamingVideoData, HttpRequestResponseInfo request); ManifestCollection getManifestCollectionMap(); void init();  }