|
jaulib v1.4.1
Jau Support Library (C++, Java, ..)
|
Classes | |
| class | ClassResources |
Helper compound associating a class instance and resource paths to be resolved at a later time. More... | |
| class | StreamMonitor |
Static Public Member Functions | |
| static int | copyURLConn2File (final URLConnection conn, final File outFile) throws IOException |
| Copy the specified URL resource to the specified output file. | |
| static int | copyStream2File (final InputStream in, final File outFile, int totalNumBytes) throws IOException |
| Copy the specified input stream to the specified output file. | |
| static int | copyStream2Stream (final InputStream in, final OutputStream out, final int totalNumBytes) throws IOException |
| Copy the specified input stream to the specified output stream. | |
| static int | copyStream2Stream (final int bufferSize, final InputStream in, final OutputStream out, final int totalNumBytes) throws IOException |
| Copy the specified input stream to the specified output stream. | |
| static StringBuilder | appendCharStream (final StringBuilder sb, final Reader r) throws IOException |
| static byte[] | copyStream2ByteArray (InputStream stream) throws IOException |
| Copy the specified input stream to a byte array, which is being returned. | |
| static ByteBuffer | copyStream2ByteBuffer (final InputStream stream) throws IOException |
| Copy the specified input stream to a NIO ByteBuffer w/ native byte order, which is being returned. | |
| static ByteBuffer | copyStream2ByteBuffer (InputStream stream, int initialCapacity) throws IOException |
| Copy the specified input stream to a NIO ByteBuffer w/ native byte order, which is being returned. | |
| static String | slashify (final String path, final boolean startWithSlash, final boolean endWithSlash) throws URISyntaxException |
| static String | getFileSuffix (final File file) |
| Returns the lowercase suffix of the given file name (the text after the last '. | |
| static String | getFileSuffix (final String filename) |
| Returns the lowercase suffix of the given file name (the text after the last '. | |
| static FileOutputStream | getFileOutputStream (final File file, final boolean allowOverwrite) throws IOException |
| static String | getClassFileName (final String clazzBinName) |
| static URL | getClassURL (final String clazzBinName, final ClassLoader cl) throws IOException |
| static String | getBasename (String fname) throws URISyntaxException |
| Returns the basename of the given fname w/o directory part. | |
| static String | getDirname (String fname) throws URISyntaxException |
| Returns unified '/' dirname including the last '/'. | |
| static URLConnection | getResource (final String resourcePath, final ClassLoader classLoader, final Class<?> relContext) |
Locating a resource using getResource(String, ClassLoader): | |
| static URLConnection | getResource (final String resourcePath, final ClassLoader cl) |
Locating a resource using the ClassLoader's facilities and org.jau.net.AssetURLContext. | |
| static String | getRelativeOf (final File baseLocation, final String relativeFile) throws URISyntaxException |
| Generates a path for the 'relativeFile' relative to the 'baseLocation'. | |
| static String | getParentOf (final String path) throws URISyntaxException |
| static String | cleanPathString (String path) throws URISyntaxException |
| static URLConnection | openURL (final URL url) |
| Returns the connected URLConnection, or null if not url is not available. | |
| static URLConnection | openURL (final URL url, final String dbgmsg) |
| Returns the connected URLConnection, or null if not url is not available. | |
| static boolean | testFile (final File file, final boolean shallBeDir, final boolean shallBeWritable) |
Test whether file exists and matches the given requirements. | |
| static boolean | testDirExec (final File dir) throws SecurityException |
Returns true if the given dir @endiliteral. | |
| static File | testDir (final File dir, final boolean create, final boolean executable) throws SecurityException |
Returns the directory dir, which is processed and tested as described below. | |
| static File | getTempDir (final boolean executable) throws SecurityException, IOException |
Returns a platform independent writable directory for temporary files consisting of the platform's temp-root + tmpSubDir, e.g. | |
| static File | createTempFile (final String prefix, final String suffix, final boolean executable) throws IllegalArgumentException, IOException, SecurityException |
Utilizing File#createTempFile(String, String, File) using getTempDir(boolean) as the directory parameter, ie. | |
| static void | close (final Closeable stream, final boolean throwRuntimeException) throws RuntimeException |
| static IOException | close (final Closeable stream, final IOException[] saveOneIfFree, final PrintStream dumpExcess) |
Helper to simplify closing Closeables. | |
| static ArrayList< String > | filesOf (final List< String > paths, final List< Pattern > excludes, final List< Pattern > includes) |
| Retrieve the list of all filenames traversing through given paths. | |
Static Public Attributes | |
| static final boolean | DEBUG |
| static final String | tmpSubDir = "jau" |
Subdirectory within platform's temporary root directory where all JogAmp related temp files are being stored: jau @endiliteral. | |
| static final Pattern | patternSpaceEnc = Pattern.compile("%20") |
Definition at line 61 of file IOUtil.java.
|
static |
Definition at line 219 of file IOUtil.java.
|
static |
| path | assuming a slashified path, either denoting a file or directory, either relative or absolute. |
./ and ../ is resolved, while keeping a starting ../ at the beginning of a relative path. | URISyntaxException | if path is empty or has no parent directory available while resolving ../ |
Definition at line 629 of file IOUtil.java.
|
static |
|
static |
Helper to simplify closing Closeables.
| stream | the Closeable instance to close |
| saveOneIfFree | cache for one IOException to store, if not already used (excess) |
| dumpExcess | dump the excess IOException on this PrintStream |
IOException or null. Definition at line 1271 of file IOUtil.java.
|
static |
Copy the specified input stream to a byte array, which is being returned.
Definition at line 231 of file IOUtil.java.
|
static |
Copy the specified input stream to a NIO ByteBuffer w/ native byte order, which is being returned.
The implementation creates the ByteBuffer w/ copyStream2ByteArray(InputStream)'s returned byte array.
| stream | input stream, which will be wrapped into a BufferedInputStream, if not already done. |
Definition at line 267 of file IOUtil.java.
|
static |
Copy the specified input stream to a NIO ByteBuffer w/ native byte order, which is being returned.
The implementation creates the ByteBuffer w/ copyStream2ByteArray(InputStream)'s returned byte array.
| stream | input stream, which will be wrapped into a BufferedInputStream, if not already done. |
| initialCapacity | initial buffer capacity in bytes, if > available bytes |
Definition at line 278 of file IOUtil.java.
|
static |
Copy the specified input stream to the specified output file.
The total number of bytes written is returned.
| in | the source |
| outFile | the destination |
| totalNumBytes | informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown |
| IOException |
Definition at line 170 of file IOUtil.java.
|
static |
Copy the specified input stream to the specified output stream.
The total number of bytes written is returned.
| in | the source |
| out | the destination |
| totalNumBytes | informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown |
| IOException |
Definition at line 190 of file IOUtil.java.
|
static |
Copy the specified input stream to the specified output stream.
The total number of bytes written is returned.
| bufferSize | the intermediate buffer size, should be MachineDataInfo#pageSizeInBytes() for best performance. |
| in | the source |
| out | the destination |
| totalNumBytes | informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown |
| IOException |
Definition at line 205 of file IOUtil.java.
|
static |
Copy the specified URL resource to the specified output file.
The total number of bytes written is returned.
| conn | the open URLConnection |
| outFile | the destination |
| IOException |
Definition at line 147 of file IOUtil.java.
|
static |
Utilizing File#createTempFile(String, String, File) using getTempDir(boolean) as the directory parameter, ie.
location of the root temp folder.
| prefix | |
| suffix | |
| executable | true if the temporary root folder needs to hold executable files, otherwise false. |
| IllegalArgumentException | |
| IOException | if no temporary directory could be determined or temp file could not be created |
| SecurityException |
Definition at line 1242 of file IOUtil.java.
|
static |
Retrieve the list of all filenames traversing through given paths.
| paths | list of paths to traverse through, containing directories and files |
| excludes | optional list of exclude Pattern. All matching files or directories will be omitted. Maybe be null or empty. |
| includes | optional list of explicit include Pattern. If given, only matching files will be returned, otherwise all occurring. |
Definition at line 1295 of file IOUtil.java.
|
static |
Returns the basename of the given fname w/o directory part.
| URISyntaxException | if path is empty or has no parent directory available while resolving ../ |
Definition at line 420 of file IOUtil.java.
|
static |
|
static |
| clazzBinName | com.jogamp.common.util.cache.TempJarCache |
| cl | ClassLoader to locate the JarFile |
| IOException | if the jar file could not been found by the ClassLoader |
Definition at line 408 of file IOUtil.java.
|
static |
Returns unified '/' dirname including the last '/'.
| URISyntaxException | if path is empty or has no parent directory available while resolving ../ |
Definition at line 433 of file IOUtil.java.
|
static |
Definition at line 386 of file IOUtil.java.
|
static |
Returns the lowercase suffix of the given file name (the text after the last '.
' in the file name). Returns null if the file name has no suffix. Only operates on the given file name; performs no I/O operations.
| file | name of the file |
| NullPointerException | if file is null |
Definition at line 349 of file IOUtil.java.
|
static |
Returns the lowercase suffix of the given file name (the text after the last '.
' in the file name). Returns null if the file name has no suffix. Only operates on the given file name; performs no I/O operations.
| filename | name of the file |
| NullPointerException | if filename is null |
Definition at line 363 of file IOUtil.java.
|
static |
| path | assuming a slashified path, either denotes a file or directory, either relative or absolute. |
| URISyntaxException | if path is empty or has no parent directory available |
Definition at line 587 of file IOUtil.java.
|
static |
Generates a path for the 'relativeFile' relative to the 'baseLocation'.
| baseLocation | denotes a directory |
| relativeFile | denotes a relative file to the baseLocation |
| URISyntaxException | if path is empty or has no parent directory available while resolving ../ |
Definition at line 569 of file IOUtil.java.
|
static |
Locating a resource using the ClassLoader's facilities and org.jau.net.AssetURLContext.
Returns the resolved and connected URLConnection or null if not found.
Return null if org.jau.net.AssetURLContext is not available.
Definition at line 554 of file IOUtil.java.
|
static |
Locating a resource using getResource(String, ClassLoader):
relContext's package name-path plus resourcePath via classLoader. This allows locations relative to JAR- and other URLs. The resourcePath may start with ../ to navigate to parent folder. This attempt is skipped if relContext is null. resourcePath as is via classLoader. Returns the resolved and open URLConnection or null if not found.
| resourcePath | the resource path to locate relative or absolute |
| classLoader | the optional ClassLoader, recommended |
| relContext | relative context, i.e. position, of the resourcePath, to perform the relative lookup, if not null. |
Definition at line 512 of file IOUtil.java.
|
static |
Returns a platform independent writable directory for temporary files consisting of the platform's temp-root + tmpSubDir, e.g.
/tmp/jau_0000/.
On standard Java the temp-root folder is specified by java.io.tempdir.
On Android the temp-root folder is relative to the applications local folder (see Context#getDir(String, int)) is returned, if the Android application/activity has registered it's Application Context via StaticContext.init(..). This allows using the temp folder w/o the need for sdcard access, which would be the java.io.tempdir location on Android!
In case temp-root is the users home folder, a dot is being prepended to tmpSubDir, i.e.: /home/user/.jau_0000/.
| executable | true if the user intents to launch executables from the temporary directory, otherwise false. |
| IOException | if no temporary directory could be determined |
| SecurityException | if access to java.io.tmpdir is not allowed within the current security context |
Definition at line 1089 of file IOUtil.java.
|
static |
Returns the connected URLConnection, or null if not url is not available.
Definition at line 657 of file IOUtil.java.
|
static |
Returns the connected URLConnection, or null if not url is not available.
Definition at line 664 of file IOUtil.java.
|
static |
| path | |
| startWithSlash | |
| endWithSlash |
| URISyntaxException | if path is empty or has no parent directory available while resolving ../ |
Definition at line 327 of file IOUtil.java.
|
static |
Returns the directory dir, which is processed and tested as described below.
create is true and the directory does not exist yet, it is created incl. all sub-directories. dirName exists, but is not a directory, null is being returned. null is being returned. executable is true and files cannot be executed from the directory, null is being returned. | dir | the directory to process |
| create | true if the directory shall be created if not existing |
| executable | true if the user intents to launch executables from the temporary directory, otherwise false. |
| SecurityException | if file creation and process execution is not allowed within the current security context |
Definition at line 1010 of file IOUtil.java.
|
static |
Returns true if the given dir @endiliteral.
| SecurityException | if file creation and process execution is not allowed within the current security context |
| dir |
Definition at line 863 of file IOUtil.java.
|
static |
Test whether file exists and matches the given requirements.
| file | |
| shallBeDir | |
| shallBeWritable |
Definition at line 767 of file IOUtil.java.
|
static |
Definition at line 62 of file IOUtil.java.
|
static |
Definition at line 652 of file IOUtil.java.
|
static |
Subdirectory within platform's temporary root directory where all JogAmp related temp files are being stored: jau @endiliteral.
Definition at line 128 of file IOUtil.java.