public final class StaticUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TAG_REPLACEMENT |
static char |
TAG_REPLACEMENT_CHAR
Char which should be used instead protected parts.
|
Modifier and Type | Method and Description |
---|---|
static <T> boolean |
arraysMatchAt(T[] needles,
T[] haystack,
int offset)
Check to see if an array contains another array.
|
static java.lang.String |
downloadFileToString(java.net.URL url,
int timeout)
Deprecated.
|
static java.util.List<java.lang.String> |
extractFromZip(java.io.InputStream in,
java.io.File destination,
java.util.function.Predicate<java.lang.String> filenameFilter)
Extracts files from an InputStream representing a zip archive to the specified destination path.
|
static java.lang.String |
getConfigDir()
Returns the location of the configuration directory, depending on the
user's platform.
|
static java.lang.String[] |
getFontNames()
Returns the names of all font families available.
|
static java.lang.String |
getScriptDir() |
static java.lang.String |
globToRegex(java.lang.String text,
boolean spaceMatchesNbsp)
Translates a string containing word-processing "glob"-style wildcards
(
? matches a single non-whitespace character, *
matches zero or more non-whitespace characters) to standard regex. |
static java.lang.String |
installDir()
Returns OmegaT installation directory.
|
static boolean |
isKey(java.awt.event.KeyEvent e,
int code,
int modifiers)
Check if specified key pressed.
|
static boolean |
isProjectDir(java.io.File f) |
static java.lang.String |
makeFilenameRelative(java.lang.String filename,
java.lang.String path)
Makes the file name relative to the given path.
|
static java.lang.String[] |
parseCLICommand(java.lang.String cmd)
Parse a command line string into arguments, interpreting
double and single quotes as Bash does.
|
static byte[] |
uudecode(java.lang.String buf)
Decodes the array of bytes that was stored in a plain text file as a
string, back to array of bytes.
|
static java.lang.String |
uuencode(byte[] buf)
Encodes the array of bytes to store them in a plain text file.
|
public static final char TAG_REPLACEMENT_CHAR
public static final java.lang.String TAG_REPLACEMENT
public static boolean isKey(java.awt.event.KeyEvent e, int code, int modifiers)
e
- pressed key eventcode
- required key codemodifiers
- required modifierspublic static java.lang.String[] getFontNames()
public static java.lang.String installDir()
public static java.lang.String getConfigDir()
public static java.lang.String getScriptDir()
public static java.lang.String uuencode(byte[] buf)
public static byte[] uudecode(java.lang.String buf)
public static java.lang.String makeFilenameRelative(java.lang.String filename, java.lang.String path)
public static java.lang.String globToRegex(java.lang.String text, boolean spaceMatchesNbsp)
?
matches a single non-whitespace character, *
matches zero or more non-whitespace characters) to standard regex.
If spaceMatchesNbsp
is true
, non-breaking
spaces (U+00A0
) will also be considered whitespace.
?
is translated to \S
(or
[^\s ]
)
*
is translated to \S*
(or
[^\s ]*
)
spaceMatchesNbsp
is true
, then
'
' is translated to ( | )
text
- The text to escapespaceMatchesNbsp
- Whether to consider regular spaces to also match non-breaking
spaces@Deprecated public static java.lang.String downloadFileToString(java.net.URL url, int timeout) throws java.io.IOException
java.io.IOException
public static java.util.List<java.lang.String> extractFromZip(java.io.InputStream in, java.io.File destination, java.util.function.Predicate<java.lang.String> filenameFilter) throws java.io.IOException
in
- InputStream representing a zip archivedestination
- Path where archive entries will be savedfilenameFilter
- Filter for entry names. Return false to skip extracting an entryjava.io.IOException
public static java.lang.String[] parseCLICommand(java.lang.String cmd)
cmd
- Command stringpublic static boolean isProjectDir(java.io.File f)
public static <T> boolean arraysMatchAt(T[] needles, T[] haystack, int offset)
needles
- The contained arrayhaystack
- The containing arrayoffset
- The offset of haystack
at which to start checkinghaystack
contains needles
at offset
java.lang.ArrayIndexOutOfBoundsException
- If offset
is not a valid index in haystack