com.hierynomus.msfscc.fileinformation.FileStandardInformation Java Examples

The following examples show how to use com.hierynomus.msfscc.fileinformation.FileStandardInformation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SMBJController.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
@Override
public long getFileLength(String fileName) {
    String filePath = getPathNotShare(fileName);

    try {
        File file = openFile(diskShare, filePath);
        FileStandardInformation standardInfo = file.getFileInformation(FileStandardInformation.class);
        return standardInfo.getEndOfFile();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return 0;
}
 
Example #2
Source File: SMBJ_RPCController.java    From DanDanPlayForAndroid with MIT License 6 votes vote down vote up
@Override
public long getFileLength(String fileName) {
    String filePath = getPathNotShare(fileName);

    try {
        File file = openFile(diskShare, filePath);
        FileStandardInformation standardInfo = file.getFileInformation(FileStandardInformation.class);
        return standardInfo.getEndOfFile();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return 0;
}
 
Example #3
Source File: SMBJController.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
/**
 * traversal directory info list filtering does not use folders and get file types
 *
 * @param dirInfoList directory list
 * @param diskShare   share
 * @return file info list
 */
private List<SmbFileInfo> getFileInfoList(List<FileIdBothDirectoryInformation> dirInfoList, DiskShare diskShare) {
    List<SmbFileInfo> fileInfoList = new ArrayList<>();
    for (FileIdBothDirectoryInformation dirInfo : dirInfoList) {
        //ignore directories beginning with '.', like '.', '..'
        if (dirInfo.getFileName().startsWith("."))
            continue;

        //get file standard info by disk entry because file type unknown
        DiskEntry diskEntry = openDiskEntry(diskShare, getPathNotShare(dirInfo.getFileName()));
        FileStandardInformation standardInformation = diskEntry.getFileInformation(FileStandardInformation.class);
        fileInfoList.add(new SmbFileInfo(dirInfo.getFileName(), standardInformation.isDirectory()));
    }
    return fileInfoList;
}
 
Example #4
Source File: SMBJ_RPCController.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
/**
 * traversal directory info list filtering does not use folders and get file types
 *
 * @param dirInfoList directory list
 * @param diskShare   share
 * @return file info list
 */
private List<SmbFileInfo> getFileInfoList(List<FileIdBothDirectoryInformation> dirInfoList, DiskShare diskShare) {
    List<SmbFileInfo> fileInfoList = new ArrayList<>();
    for (FileIdBothDirectoryInformation dirInfo : dirInfoList) {
        //ignore directories beginning with '.', like '.', '..'
        if (dirInfo.getFileName().startsWith("."))
            continue;

        //get file standard info by disk entry because file type unknown
        DiskEntry diskEntry = openDiskEntry(diskShare, getPathNotShare(dirInfo.getFileName()));
        FileStandardInformation standardInformation = diskEntry.getFileInformation(FileStandardInformation.class);
        fileInfoList.add(new SmbFileInfo(dirInfo.getFileName(), standardInformation.isDirectory()));
    }
    return fileInfoList;
}
 
Example #5
Source File: Samba2FileSystem.java    From iaf with Apache License 2.0 5 votes vote down vote up
public FilesIterator(String parent, List<FileIdBothDirectoryInformation> list) {
	prefix = parent != null ? parent + "\\" : "";
	files = new ArrayList<FileIdBothDirectoryInformation>();
	for (FileIdBothDirectoryInformation info : list) {
		if (!StringUtils.equals(".", info.getFileName()) && !StringUtils.equals("..", info.getFileName())) {
			boolean isHidden = EnumWithValue.EnumUtils.isSet(info.getFileAttributes(), FileAttributes.FILE_ATTRIBUTE_HIDDEN);
			try {
				FileStandardInformation fai = diskShare.getFileInformation(prefix + info.getFileName()).getStandardInformation();
				boolean accessible = !fai.isDeletePending();
				boolean isDirectory = fai.isDirectory();
				if (accessible && !isDirectory) {
					if (isListHiddenFiles()) {
						files.add(info);
					} else {
						if (!isHidden) {
							files.add(info);
						}
					}
				}
			} catch (SMBApiException e) {
				if(NtStatus.valueOf(e.getStatusCode()).equals(NtStatus.STATUS_DELETE_PENDING)) {
					log.debug("delete pending for file ["+ info.getFileName()+"]");
				} else {
					throw e;
				}
			}

		}
	}
}
 
Example #6
Source File: SMB2Utils.java    From CloverETL-Engine with GNU Lesser General Public License v2.1 4 votes vote down vote up
public AppendOutputStream(File file) {
	this.file = Objects.requireNonNull(file);
	this.fileOffset = file.getFileInformation(FileStandardInformation.class).getEndOfFile();
}
 
Example #7
Source File: PrimitiveSMB2OperationHandler.java    From CloverETL-Engine with GNU Lesser General Public License v2.1 4 votes vote down vote up
private FileStandardInformation getStandardInformation() {
	return file.getStandardInformation();
}