in java/main/src/main/java/com/epam/deltix/utilities/ResourceLoader.java [59:113]
public Resource(final String source, final int initialOrder, final long length, final String dllExt) {
this.source = source;
log("Adding resource file: %s", source);
final HashMap<String, String> tags = new HashMap<>();
final Path sourcePath = Paths.get(source);
final String resourceName = sourcePath.getFileName().toString();
String fileName = getTags(resourceName, tags)
.replace('_', '.');
this.isZstd = fileName.toLowerCase(Locale.ROOT).endsWith(".zst");
if (isZstd)
fileName = ResourceLoaderUtils.shortenBy(fileName, 4);
// Owner can optionally rename the resource
this.destinationName = fileName;
this.destinationPathNullable = sourcePath.getParent();
this.isDll = fileName.toLowerCase(Locale.ROOT).endsWith(dllExt);
// Parse file order tags
int order = initialOrder;
for (final Map.Entry<String, String> kv : tags.entrySet()) {
final String key = kv.getKey();
final String value = kv.getValue();
if (key.equals("order")) {
order = -1;
try {
order = Integer.parseInt(value);
} catch (final NumberFormatException e) {
}
if (order < 0)
throw argException("Order tag invalid, non-negative integer expected: [order@%s]", value);
order += Integer.MIN_VALUE; // Needed to combine natural order and explicit order
} else
throw argException("Invalid Tag: [%s@%s]", key, value);
}
this.order = order;
// if (length < 0)
// length = STREAM_URL == type ? ((URL)source).openConnection().getContentLength() : Files.size((Path)source);
log("Length: %s", length);
if (length < 0)
throw argException("Resource file '%s' length is negative: %s", source, length);
if (length > Integer.MAX_VALUE)
throw argException("Resource file '%s' length is too big: %s", source, length);
this.length = (int) length;
}