List of usage examples for java.io FileInputStream getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.acmsl.commons.utils.io.FileUtils.java
/** * Retrieves the {@link File} associated to given {@link FileInputStream}, if possible. * @param inputStream the input stream./*from ww w . j av a 2s .c om*/ * @return the file. */ @Nullable public File retrieveFile(@NotNull final FileInputStream inputStream) { @Nullable final File result; @Nullable String t_strPath = null; try { @Nullable final Field field = inputStream.getClass().getDeclaredField("path"); field.setAccessible(true); t_strPath = (String) field.get(inputStream); } catch (@NotNull final Throwable noField) { System.err.println(noField.getMessage()); } if (t_strPath == null) { result = null; } else { result = new File(t_strPath); } return result; }