/** * Gets the input stream of the given path * * @return the input stream of the given path * @throws IOException * if there is an exception while receiving the input stream */ protected InputStream getInputStream() throws IOException { return Files.newInputStream(getPath()); }
/** * Gets the input stream of the given path * * @return the input stream of the given path * @throws IOException * if there is an exception while receiving the input stream */ protected InputStream getInputStream() throws IOException { return Files.newInputStream(getPath()); }
/** * Gets the size of the resource * * @return the size of the resource * @throws IOException * if the size attribute can't be read */ protected long getSize() throws IOException { return Files.readAttributes(getPath(), BasicFileAttributes.class).size(); }
/** * Creates a new resource response and reads the given path */ @Override protected ResourceResponse newResourceResponse(Attributes attributes) { return createResourceResponse(attributes, getPath()); }
/** * Gets the size of the resource * * @return the size of the resource * @throws IOException * if the size attribute can't be read */ protected long getSize() throws IOException { return Files.readAttributes(getPath(), BasicFileAttributes.class).size(); }
/** * Creates a new resource response and reads the given path */ @Override protected ResourceResponse newResourceResponse(Attributes attributes) { return createResourceResponse(attributes, getPath()); }
/** * Gets the mime type to be used for the response it first uses the URL connection to get the * mime type and after this the FileTypeDetector SPI is used. * * @return the mime type to be used for the response * @throws IOException * if the mime type couldn't be resolved */ protected String getMimeType() throws IOException { final Path _path = getPath(); String mimeType = null; if (Application.exists()) { mimeType = Application.get().getMimeType(_path.getFileName().toString()); } if (mimeType == null) { mimeType = Files.probeContentType(_path); } return mimeType; }
/** * Gets the mime type to be used for the response it first uses the URL connection to get the * mime type and after this the FileTypeDetector SPI is used. * * @return the mime type to be used for the response * @throws IOException * if the mime type couldn't be resolved */ protected String getMimeType() throws IOException { final Path _path = getPath(); String mimeType = null; if (Application.exists()) { mimeType = Application.get().getMimeType(_path.getFileName().toString()); } if (mimeType == null) { mimeType = Files.probeContentType(_path); } return mimeType; }