|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This report was generated with an evaluation server license. Purchase Clover or configure your license. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
VersionParser | Line # 31 | 9 | 3 | 0% |
0.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
No Tests | |||
1 | /* | |
2 | This file is part of Subsonic. | |
3 | ||
4 | Subsonic is free software: you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation, either version 3 of the License, or | |
7 | (at your option) any later version. | |
8 | ||
9 | Subsonic is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with Subsonic. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | Copyright 2009 (C) Sindre Mehus | |
18 | */ | |
19 | package net.sourceforge.subsonic.androidapp.service.parser; | |
20 | ||
21 | import net.sourceforge.subsonic.androidapp.domain.Version; | |
22 | ||
23 | import java.io.BufferedReader; | |
24 | import java.io.Reader; | |
25 | import java.util.regex.Matcher; | |
26 | import java.util.regex.Pattern; | |
27 | ||
28 | /** | |
29 | * @author Sindre Mehus | |
30 | */ | |
31 | public class VersionParser { | |
32 | ||
33 | 0 |
![]() |
34 | ||
35 | 0 | BufferedReader bufferedReader = new BufferedReader(reader); |
36 | 0 | Pattern pattern = Pattern.compile("SUBSONIC_ANDROID_VERSION_BEGIN(.*)SUBSONIC_ANDROID_VERSION_END"); |
37 | 0 | String line = bufferedReader.readLine(); |
38 | 0 | while (line != null) { |
39 | 0 | Matcher finalMatcher = pattern.matcher(line); |
40 | 0 | if (finalMatcher.find()) { |
41 | 0 | return new Version(finalMatcher.group(1)); |
42 | } | |
43 | 0 | line = bufferedReader.readLine(); |
44 | } | |
45 | 0 | return null; |
46 | } | |
47 | } |
|