INT-3696: Use StringBuilder in FtpFileInfo
JIRA: https://jira.spring.io/browse/INT-3696
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,13 +17,14 @@
|
||||
package org.springframework.integration.ftp.session;
|
||||
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
|
||||
import org.springframework.integration.file.remote.AbstractFileInfo;
|
||||
import org.springframework.integration.file.remote.FileInfo;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* A {@link FileInfo} implementation for FTP/FTPS.
|
||||
*
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -36,28 +37,34 @@ public class FtpFileInfo extends AbstractFileInfo<FTPFile> {
|
||||
this.ftpFile = ftpFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDirectory() {
|
||||
return this.ftpFile.isDirectory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLink() {
|
||||
return this.ftpFile.isSymbolicLink();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSize() {
|
||||
return this.ftpFile.getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getModified() {
|
||||
return this.ftpFile.getTimestamp().getTimeInMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFilename() {
|
||||
return this.ftpFile.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPermissions() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (this.ftpFile.isDirectory()) {
|
||||
sb.append("d");
|
||||
} else if (this.ftpFile.isSymbolicLink()) {
|
||||
@@ -113,6 +120,7 @@ public class FtpFileInfo extends AbstractFileInfo<FTPFile> {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FTPFile getFileInfo() {
|
||||
return this.ftpFile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user