@Override protected boolean isFile(SmbFile _file) { try { return _file != null && _file.isFile(); } catch (Exception _ex) { logger.warn("Unable to get resource status [" + _file + "].", _ex); } return false; }
/** * Checks whether the remote resource is a file. * @param _path remote path * @return true if resource is a file, false otherwise * @throws IOException on error conditions returned by a CIFS server */ public boolean isFile(String _path) throws IOException { SmbFile resource = createSmbFileObject(_path); return resource.exists() && resource.isFile(); }
@Override public InputStream readRaw(String source) throws IOException { SmbFile remoteFile = createSmbFileObject(source); if (!remoteFile.isFile()) { throw new NestedIOException("Resource [" + source + "] is not a file."); } return remoteFile.getInputStream(); }
/** * Reads the remote resource specified by path and copies its contents to the specified * {@link OutputStream}. * @param _path path to a remote file * @param _outputStream output stream * @throws IOException on error conditions returned by a CIFS server or if the remote resource is not a file. */ @Override public void read(String _path, OutputStream _outputStream) throws IOException { Assert.hasText(_path, "path must not be empty"); Assert.notNull(_outputStream, "outputStream must not be null"); try { SmbFile remoteFile = createSmbFileObject(_path); if (!remoteFile.isFile()) { throw new NestedIOException("Resource [" + _path + "] is not a file."); } FileCopyUtils.copy(remoteFile.getInputStream(), _outputStream); } catch (SmbException _ex) { throw new NestedIOException("Failed to read resource [" + _path + "].", _ex); } if (logger.isInfoEnabled()) { logger.info("Successfully read resource [" + _path + "]."); } }
/** * Determines the type of the file, returns null if the file does not exist. */ @Override protected FileType doGetType() throws Exception { if (!file.exists()) { return FileType.IMAGINARY; } else if (file.isDirectory()) { return FileType.FOLDER; } else if (file.isFile()) { return FileType.FILE; } throw new FileSystemException("vfs.provider.smb/get-type.error", getName()); }
/** * Determines the type of the file, returns null if the file does not * exist. */ @Override protected FileType doGetType() throws Exception { if (!file.exists()) { return FileType.IMAGINARY; } else if (file.isDirectory()) { return FileType.FOLDER; } else if (file.isFile()) { return FileType.FILE; } throw new FileSystemException("vfs.provider.smb/get-type.error", getName()); }
try if ( !file.isFile() )
responseData.setCharSet(charset); responseData.setContentLength(0); } else if (file.isFile()) { if (logger.isDebugEnabled()) { logger.debug("Checking SmbFile Size: " + filePath);
responseData.setCharSet(charset); responseData.setContentLength(0); } else if (file.isFile()) { final MimeTypeHelper mimeTypeHelper = SingletonS2Container.getComponent("mimeTypeHelper");
responseData.setCharSet(charset); responseData.setContentLength(0); } else if (file.isFile()) { final MimeTypeHelper mimeTypeHelper = robotContainer .getComponent("mimeTypeHelper");
responseData.setCharSet(charset); responseData.setContentLength(0); } else if (file.isFile()) { final MimeTypeHelper mimeTypeHelper = SingletonS2Container.getComponent("mimeTypeHelper");