com.zusmart.base.scanner.support.AbstractScannerResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zusmart-base Show documentation
Show all versions of zusmart-base Show documentation
提供基础的工具类及方法类,Logging,Scanner,Buffer,NetWork,Future,Thread
package com.zusmart.base.scanner.support;
import java.util.jar.JarEntry;
import com.zusmart.base.scanner.ScannerResult;
public abstract class AbstractScannerResult implements ScannerResult {
private final String name;
private final String path;
protected AbstractScannerResult(String name, String path) {
this.name = name;
this.path = path;
}
@Override
public String getName() {
return this.name;
}
@Override
public String getPath() {
return this.path;
}
@Override
public String toString() {
return String.format("[%s-%s] %s", this.isFromDirFile() ? "DIR" : "JAR", this.getName(), this.getPath());
}
protected static String getFileName(JarEntry jarEntry) {
String entryName = jarEntry.getName();
int index = entryName.lastIndexOf("/");
if (index >= 0) {
entryName = entryName.substring(index + 1);
}
return entryName;
}
}