@Test public void testUnparseable_noPrefix() { TsDumpFileUtils.FreqBandwidth res = TsDumpFileUtils.getFreqAndBandwidth(new File(ROOT, "506000000_8000000_20170110130424.ts")); assertThat(res, nullValue()); }
@VisibleForTesting static FreqBandwidth getFreqAndBandwidth(File file) { if (!"ts".equals(getExtension(file))) return null; String[] parts = file.getName().toLowerCase().split("_"); if (parts.length != 4) return null; if (!"mux".equals(parts[0])) return null; try { long freq = Long.parseLong(parts[1]); long bandwidth = Long.parseLong(parts[2]); return new FreqBandwidth(freq, bandwidth); } catch (NumberFormatException ignored) { return null; } }
TsDumpFileUtils { @VisibleForTesting static FreqBandwidth getFreqAndBandwidth(File file) { if (!"ts".equals(getExtension(file))) return null; String[] parts = file.getName().toLowerCase().split("_"); if (parts.length != 4) return null; if (!"mux".equals(parts[0])) return null; try { long freq = Long.parseLong(parts[1]); long bandwidth = Long.parseLong(parts[2]); return new FreqBandwidth(freq, bandwidth); } catch (NumberFormatException ignored) { return null; } } }
TsDumpFileUtils { @VisibleForTesting static FreqBandwidth getFreqAndBandwidth(File file) { if (!"ts".equals(getExtension(file))) return null; String[] parts = file.getName().toLowerCase().split("_"); if (parts.length != 4) return null; if (!"mux".equals(parts[0])) return null; try { long freq = Long.parseLong(parts[1]); long bandwidth = Long.parseLong(parts[2]); return new FreqBandwidth(freq, bandwidth); } catch (NumberFormatException ignored) { return null; } }  }
TsDumpFileUtils { @VisibleForTesting static FreqBandwidth getFreqAndBandwidth(File file) { if (!"ts".equals(getExtension(file))) return null; String[] parts = file.getName().toLowerCase().split("_"); if (parts.length != 4) return null; if (!"mux".equals(parts[0])) return null; try { long freq = Long.parseLong(parts[1]); long bandwidth = Long.parseLong(parts[2]); return new FreqBandwidth(freq, bandwidth); } catch (NumberFormatException ignored) { return null; } }  static File getFor(Context ctx, long freq, long bandwidth, Date date); static List<DvbDevice> getDevicesForAllRecordings(Context ctx); }
TsDumpFileUtils { @VisibleForTesting static FreqBandwidth getFreqAndBandwidth(File file) { if (!"ts".equals(getExtension(file))) return null; String[] parts = file.getName().toLowerCase().split("_"); if (parts.length != 4) return null; if (!"mux".equals(parts[0])) return null; try { long freq = Long.parseLong(parts[1]); long bandwidth = Long.parseLong(parts[2]); return new FreqBandwidth(freq, bandwidth); } catch (NumberFormatException ignored) { return null; } }  static File getFor(Context ctx, long freq, long bandwidth, Date date); static List<DvbDevice> getDevicesForAllRecordings(Context ctx);  }