MCPcopy Create free account
hub / github.com/cinit/TMoe / getShortFileName

Method getShortFileName

app/src/main/java/cc/ioctl/tmoe/util/IoUtils.java:190–205  ·  view source on GitHub ↗
(@NonNull String fileName)

Source from the content-addressed store, hash-verified

188 }
189
190 @NonNull
191 public static String getShortFileName(@NonNull String fileName) {
192 Objects.requireNonNull(fileName, "fileName == null");
193 if (fileName.isEmpty()) {
194 throw new IllegalArgumentException("fileName is empty");
195 }
196 if (fileName.endsWith(File.separator)) {
197 throw new IllegalArgumentException("fileName ends with File.separatorChar");
198 }
199 int index = fileName.lastIndexOf(File.separatorChar);
200 if (index == -1) {
201 return fileName;
202 } else {
203 return fileName.substring(index + 1);
204 }
205 }
206
207 @NonNull
208 public static String getShortFileName(@NonNull File file) {

Callers

nothing calls this directly

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected