| 1234567891011121314151617181920212223 |
- package com.ruoyi.app.push;
- import org.springframework.core.io.ClassPathResource;
- import java.io.IOException;
- import java.io.InputStream;
- import java.nio.file.Files;
- import java.nio.file.Path;
- /** Opens bundled push credentials while retaining absolute file path compatibility. */
- final class PushCredentialResource {
- private static final String CLASSPATH_PREFIX = "classpath:";
- private PushCredentialResource() {
- }
- static InputStream open(String location) throws IOException {
- if (location.startsWith(CLASSPATH_PREFIX)) {
- return new ClassPathResource(location.substring(CLASSPATH_PREFIX.length())).getInputStream();
- }
- return Files.newInputStream(Path.of(location));
- }
- }
|