class FileBrowser extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
FileBrowser.Browser |
(package private) static class |
FileBrowser.CompareTableData
This class holds data for a line of the file comparison
table.
|
(package private) static class |
FileBrowser.DataNameComparator |
(package private) static class |
FileBrowser.Direction
An enum whose members indicate the possible operations between
pairs of files.
|
(package private) static class |
FileBrowser.EditWindow
An undoable text edit window
This is the base class for all of the text windows.
|
(package private) static class |
FileBrowser.FindReplace
This class provides a search and replace function for a file edit
window.
|
(package private) static class |
FileBrowser.LocalPath
Implements a path (MyPath) in the local file system.
|
(package private) static class |
FileBrowser.MyComboBox |
(package private) static class |
FileBrowser.MyPath
This class is the superclass of all path-type objects.
|
(package private) static class |
FileBrowser.MyProgMon
MyProgMon is an implementation of a file transfer progress
monitor.
|
(package private) static class |
FileBrowser.MyTextTransferHandler
This class handles JTextField drag & drop.
|
(package private) static class |
FileBrowser.MyTreeNode
This class is a pure data structure and represents a node in a
JTree.
|
(package private) static class |
FileBrowser.MyUserInfo |
(package private) static class |
FileBrowser.PathComparator
This comparator of Paths puts directories first, then sorts
ignoring case, then considering case.
|
(package private) class |
FileBrowser.PathCompare
Table of updates to perform.
|
(package private) static class |
FileBrowser.RemotePath
An object that may be used to locate a file in a remote file
system.
|
(package private) static class |
FileBrowser.RootPath
A singleton class representing the root node of the tree.
|
(package private) static class |
FileBrowser.SftpOpenFailedException |
(package private) static class |
FileBrowser.SSHWindow
A SSHWindow is a shell window on a remote system.
|
(package private) static class |
FileBrowser.TableData
This class is just a data structure with the table information
|
(package private) static class |
FileBrowser.TableDataComparator |
(package private) static class |
FileBrowser.TreeNodeComparator |
(package private) static class |
FileBrowser.UndoableTextArea |
Modifier and Type | Field and Description |
---|---|
(package private) static java.awt.Color |
BLACK |
(package private) static java.awt.Color |
BLUE |
(package private) static java.awt.Color |
BROWN |
(package private) static java.util.TreeMap<java.lang.String,java.util.Stack<com.jcraft.jsch.ChannelSftp>> |
channels |
(package private) static java.nio.charset.Charset |
charSet |
(package private) static java.awt.datatransfer.Clipboard |
clipboard |
(package private) static java.awt.Color |
CYAN |
(package private) FileBrowser.Direction[] |
d |
(package private) static FileBrowser.DataNameComparator |
dataNameComparator |
(package private) static java.nio.charset.Charset |
fileCharset |
(package private) static java.nio.file.FileSystem |
fileSystem |
(package private) static java.awt.Color |
GREEN |
(package private) static char[] |
hex |
(package private) static char |
hi |
(package private) static java.lang.String |
home |
(package private) static com.jcraft.jsch.JSch |
jsch |
(package private) static java.lang.String |
legalHex |
(package private) static java.awt.Color |
LIGHT_GRAY |
(package private) static java.awt.Color |
LIGHT_YELLOW |
(package private) static char |
lo |
(package private) static java.awt.Color |
MAGENTA |
(package private) static FileBrowser.MyProgMon |
myProgMon |
(package private) static java.nio.file.Path |
optionPath |
(package private) static java.util.TreeMap<java.lang.String,java.util.ArrayList<java.lang.String>> |
options |
(package private) static java.awt.Color |
ORANGE |
(package private) static java.lang.String |
passwordKey |
(package private) static FileBrowser.PathComparator |
pathComparator |
(package private) static java.nio.file.attribute.PosixFilePermission[] |
permissions |
(package private) static java.awt.Color |
PINK |
(package private) static java.awt.Color |
RED |
(package private) static java.awt.datatransfer.DataFlavor |
remotePathArrayFlavor |
(package private) static java.util.ArrayList<FileBrowser.RemotePath> |
remoteRoots |
(package private) static int |
replaceDirectoryWithFile |
(package private) static int |
replaceFile |
(package private) static int |
replaceFileWithDirectory |
(package private) static FileBrowser.RootPath |
root |
(package private) static java.lang.String |
rootName |
(package private) FileBrowser.MyPath |
selectedPath |
(package private) static java.lang.String |
selectionsKey |
(package private) static long |
serialVersionUID |
(package private) static java.util.TreeMap<java.lang.String,com.jcraft.jsch.Session> |
sessions |
(package private) static java.nio.file.attribute.PosixFilePermission[] |
stuff |
(package private) static FileBrowser.TableDataComparator |
tableDataComparator |
(package private) static java.awt.Toolkit |
toolkit |
(package private) static FileBrowser.TreeNodeComparator |
treeNodeComparator |
(package private) static java.awt.Color |
WHITE |
(package private) static int |
windowCount |
(package private) static boolean |
windows |
(package private) static boolean |
windowsXPDSTHack |
(package private) static java.awt.Color |
YELLOW |
Constructor and Description |
---|
FileBrowser() |
Modifier and Type | Method and Description |
---|---|
(package private) static java.lang.String |
addCommas(java.lang.String s)
Takes a String that is presumed to be an integer and inserts
commas every third digit.
|
(package private) static java.lang.String |
bytesToString(byte[] bytes)
Convert a byte[] to an escaped String
List of non-escaped characters determined empirically by
converting to Path and back to URI.
|
(package private) static FileBrowser.MyPath |
changePrefix(FileBrowser.MyPath oldPrefix,
FileBrowser.MyPath newPrefix,
FileBrowser.MyPath path)
Replaces the prefix of a path with a new prefix.
|
(package private) static boolean |
copyTree(FileBrowser.MyPath from,
FileBrowser.MyPath to,
int flags,
javax.swing.JLabel feedback)
Copies a file or a complete directory tree.
|
(package private) static java.lang.String |
decrypt(java.lang.String seed,
java.lang.String data)
Decrypts a password for storing in options file.
|
(package private) static boolean |
deleteTree(FileBrowser.MyPath path,
javax.swing.JLabel feedback)
Deletes a file or an entire directory tree
|
(package private) static void |
diff(FileBrowser.MyPath path1,
FileBrowser.MyPath path2)
Perform a diff between two files.
|
(package private) static java.lang.String |
encrypt(java.lang.String seed,
java.lang.String data)
Encrypts a password for storing in options file.
|
(package private) FileBrowser.MyPath |
endEditing(FileBrowser.MyComboBox comboBox) |
(package private) static void |
finish()
Called to shut down everything at the end of running the program.
|
(package private) static java.lang.String |
flatten(java.lang.String uri)
Removes all % escape sequences from a String.
|
(package private) static FileBrowser.MyPath |
getHomeDirectoryx(java.lang.String authority)
Gets the home directory using the authority of a URI.
|
(package private) static java.util.TreeSet<FileBrowser.TableData> |
getRootPaths(boolean dotFiles)
Returns the current root Paths.
|
(package private) static com.jcraft.jsch.Session |
getSession(java.lang.String userHost)
Open a session on the given user@host.
|
(package private) static com.jcraft.jsch.ChannelSftp |
getSftpChannel(java.lang.String userHost)
Get a sftp channel on the given user@host.
|
(package private) static java.lang.String |
getSuffix(FileBrowser.MyPath base,
FileBrowser.MyPath path)
Gets the part of a base path after the base path.
|
(package private) static java.util.Set<java.nio.file.attribute.PosixFilePermission> |
javaFilePermissionsx(int octal)
Get a set of POSIX file permissions from an octal file permissions.
|
static void |
main(java.lang.String[] args)
Start a file browser on specified files.
|
(package private) static void |
makeBrowser(FileBrowser.MyPath path)
Make a FileBrowser on the indicated path.
|
(package private) void |
makeFileEditWindow(FileBrowser.MyPath path)
Make a file edit window for editing files.
|
(package private) static boolean |
moveTree(FileBrowser.MyPath from,
FileBrowser.MyPath to)
Moves a file or directory.
|
(package private) static int |
octalFilePermissionsx(java.util.Set<java.nio.file.attribute.PosixFilePermission> perms)
Get an integer file permissions from a set of POSIX file permissions.
|
(package private) static void |
readOptions()
This class reads all of the user options readfrom
optionPath.
|
(package private) static java.lang.String |
readPath(FileBrowser.MyPath path)
Read the file at MyPath and return it as a String.
|
(package private) static void |
releaseChannel(com.jcraft.jsch.ChannelSftp channel)
When a client is done using a channel it must be released by
calling this method so the channel can be used by someone
else.
|
(package private) static byte[] |
stringToBytes(java.lang.String s)
Convert a String to byte[]
|
(package private) static FileBrowser.MyPath |
stringToMyPath(java.lang.String s)
Creates an appropriate subclass instance of MyPath from a
string.
|
(package private) static java.net.URI |
toUri(java.lang.String s)
Convert an "escaped" string to a URI.
|
(package private) static void |
writeOptions()
This class writes all of the user options from optionPath.
|
(package private) static void |
writePath(FileBrowser.MyPath path,
java.lang.String s)
Write the contents of a String to the file at MyPath.
|
static final long serialVersionUID
static final java.awt.Color BLACK
static final java.awt.Color LIGHT_GRAY
static final java.awt.Color WHITE
static final java.awt.Color BROWN
static final java.awt.Color RED
static final java.awt.Color PINK
static final java.awt.Color ORANGE
static final java.awt.Color YELLOW
static final java.awt.Color LIGHT_YELLOW
static final java.awt.Color GREEN
static final java.awt.Color CYAN
static final java.awt.Color BLUE
static final java.awt.Color MAGENTA
static boolean windows
static int windowCount
static com.jcraft.jsch.JSch jsch
static java.nio.charset.Charset charSet
static java.nio.file.FileSystem fileSystem
static java.awt.Toolkit toolkit
static java.awt.datatransfer.Clipboard clipboard
static java.lang.String home
static java.nio.file.Path optionPath
static java.util.TreeMap<java.lang.String,java.util.ArrayList<java.lang.String>> options
static final java.lang.String passwordKey
static final java.lang.String selectionsKey
static java.nio.charset.Charset fileCharset
static final char[] hex
static final java.lang.String legalHex
static java.lang.String rootName
static FileBrowser.RootPath root
static java.util.ArrayList<FileBrowser.RemotePath> remoteRoots
static java.util.TreeMap<java.lang.String,com.jcraft.jsch.Session> sessions
static java.util.TreeMap<java.lang.String,java.util.Stack<com.jcraft.jsch.ChannelSftp>> channels
static java.awt.datatransfer.DataFlavor remotePathArrayFlavor
static java.nio.file.attribute.PosixFilePermission[] permissions
static java.nio.file.attribute.PosixFilePermission[] stuff
static FileBrowser.MyProgMon myProgMon
static final int replaceFile
static final int replaceFileWithDirectory
static final int replaceDirectoryWithFile
static FileBrowser.TableDataComparator tableDataComparator
static FileBrowser.DataNameComparator dataNameComparator
static FileBrowser.PathComparator pathComparator
static FileBrowser.TreeNodeComparator treeNodeComparator
static boolean windowsXPDSTHack
static final char lo
static final char hi
FileBrowser.MyPath selectedPath
FileBrowser()
static java.lang.String flatten(java.lang.String uri)
uri
- the String to be flattenedstatic java.lang.String bytesToString(byte[] bytes)
bytes
- array of bytes to convertstatic byte[] stringToBytes(java.lang.String s)
s
- the String to convertstatic java.net.URI toUri(java.lang.String s)
s
- the string to be convertedstatic com.jcraft.jsch.Session getSession(java.lang.String userHost) throws FileBrowser.SftpOpenFailedException
userHost
- the user@host string specifying where to open the sessionFileBrowser.SftpOpenFailedException
- if the open failsstatic com.jcraft.jsch.ChannelSftp getSftpChannel(java.lang.String userHost) throws FileBrowser.SftpOpenFailedException
userHost
- the user@host to open the sftp channelFileBrowser.SftpOpenFailedException
- if the open failsstatic void releaseChannel(com.jcraft.jsch.ChannelSftp channel)
channel
- the channel to be released for future usestatic FileBrowser.MyPath stringToMyPath(java.lang.String s)
s
- String to convertstatic java.util.TreeSet<FileBrowser.TableData> getRootPaths(boolean dotFiles)
dotFiles
- true if dot files are to be includedstatic java.lang.String addCommas(java.lang.String s)
s
- String containing an integerstatic int octalFilePermissionsx(java.util.Set<java.nio.file.attribute.PosixFilePermission> perms)
perms
- set of POSIX file permissionsstatic java.util.Set<java.nio.file.attribute.PosixFilePermission> javaFilePermissionsx(int octal)
octal
- integer file permissionsstatic FileBrowser.MyPath getHomeDirectoryx(java.lang.String authority)
authority
- the authority of a URIstatic boolean copyTree(FileBrowser.MyPath from, FileBrowser.MyPath to, int flags, javax.swing.JLabel feedback)
from
- the file or directory to copyto
- the file or directory to copy toflags
- bit map of what to allowfeedback
- a JLabel where to display current file/directorystatic boolean moveTree(FileBrowser.MyPath from, FileBrowser.MyPath to)
from
- the file or tree to moveto
- the directory to move the file or directory tostatic boolean deleteTree(FileBrowser.MyPath path, javax.swing.JLabel feedback)
path
- the file or directory to deletefeedback
- A JLabel for posting progress feedbackstatic void finish()
static java.lang.String readPath(FileBrowser.MyPath path)
path
- the path to the file to be readstatic void writePath(FileBrowser.MyPath path, java.lang.String s)
path
- the path to the file to be writtens
- the String to be written outvoid makeFileEditWindow(FileBrowser.MyPath path)
path
- the Path to the file to be editedstatic void diff(FileBrowser.MyPath path1, FileBrowser.MyPath path2)
path1
- the MyPath for the first filepath2
- the MyPath for the second filestatic void readOptions()
static void writeOptions()
static java.lang.String encrypt(java.lang.String seed, java.lang.String data)
seed
- a seed for encryptiondata
- a string for encryptionstatic java.lang.String decrypt(java.lang.String seed, java.lang.String data)
seed
- a seed for decryptiondata
- a string for decryptionFileBrowser.MyPath endEditing(FileBrowser.MyComboBox comboBox)
static void makeBrowser(FileBrowser.MyPath path)
path
- a MyPath to make a FileBrowser onstatic java.lang.String getSuffix(FileBrowser.MyPath base, FileBrowser.MyPath path)
base
- MyPath of the base Pathpath
- the full path whose base will be eliminatedstatic FileBrowser.MyPath changePrefix(FileBrowser.MyPath oldPrefix, FileBrowser.MyPath newPrefix, FileBrowser.MyPath path)
oldPrefix
- the prefix of the path to be removednewPrefix
- the new prefix of the truncated pathpath
- the path whose prefix is to be changedpublic static void main(java.lang.String[] args)
args
- list of files to start file browsers on