|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.util.WWIO
public class WWIO
| Field Summary | |
|---|---|
static String |
ILLEGAL_FILE_PATH_PART_CHARACTERS
|
| Constructor Summary | |
|---|---|
WWIO()
|
|
| Method Summary | |
|---|---|
static void |
closeStream(Object stream,
String name)
Close a stream and catch any IOException generated in the process. |
static Proxy |
configureProxy()
|
static void |
copyDirectory(File source,
File destination,
boolean copySubDirectories)
|
static void |
copyFile(File source,
File destination)
|
static void |
deleteDirectory(File file)
|
static String |
formPath(String... pathParts)
|
static Object |
getFileOrResourceAsStream(String path,
Class c)
|
static InputStream |
getInputStreamFromByteBuffer(ByteBuffer buffer)
Creates an InputStream for the contents of a ByteBuffer. |
static InputStream |
getInputStreamFromString(String string)
Creates an InputStream for the contents of a String. |
static String |
getSuffix(String filePath)
|
static boolean |
isAncestorOf(File file,
File ancestor)
|
static boolean |
isFileOutOfDate(URL url,
long expiryTime)
|
static String |
makeSuffixForMimeType(String mimeType)
|
static MappedByteBuffer |
mapFile(File file)
|
static InputStream |
openFileOrResourceStream(String fileName,
Class c)
Opens a file located via an absolute path or a path relative to the classpath. |
static ByteBuffer |
readFileToBuffer(File file)
|
static ByteBuffer |
readStreamToBuffer(InputStream inputStream)
|
static String |
readTextFile(File file)
Open and read a text file into String. |
static ByteBuffer |
readURLContentToBuffer(URL url)
|
static ByteBuffer |
readZipEntryToBuffer(File zipFile,
String entryName)
|
static String |
replaceSuffix(String in,
String newSuffix)
|
static boolean |
saveBuffer(ByteBuffer buffer,
File file)
|
static boolean |
saveBuffer(ByteBuffer buffer,
File file,
boolean forceFilesystemWrite)
|
static File |
saveBufferToTempFile(ByteBuffer buffer,
String suffix)
|
static String |
stripIllegalFileNameCharacters(String s)
|
static String |
stripLeadingSeparator(String s)
|
static String |
stripLeadingZeros(String s)
|
static String |
stripTrailingSeparator(String s)
|
static void |
writeTextFile(String text,
File file)
Save a String to a text file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ILLEGAL_FILE_PATH_PART_CHARACTERS
| Constructor Detail |
|---|
public WWIO()
| Method Detail |
|---|
public static void closeStream(Object stream,
String name)
IOException generated in the process. Stream types supported are InputStream, OutputStream, Reader and Writer.
stream - the stream to close. If null, this method does nothing.name - the name of the stream to place in the log message if an exception is encountered.public static Proxy configureProxy()
public static void copyDirectory(File source,
File destination,
boolean copySubDirectories)
throws IOException
IOException
public static void copyFile(File source,
File destination)
throws IOException
IOException
public static void deleteDirectory(File file)
throws IOException
IOExceptionpublic static String formPath(String... pathParts)
public static Object getFileOrResourceAsStream(String path,
Class c)
public static InputStream getInputStreamFromByteBuffer(ByteBuffer buffer)
InputStream for the contents of a ByteBuffer. The method creates a copy of the
buffer's contents and passes a steam reference to that copy.
buffer - the buffer to create a stream for.
InputStream for the buffer's contents.
IllegalArgumentException - if buffer is null.public static InputStream getInputStreamFromString(String string)
InputStream for the contents of a String. The method creates a copy of the string's
contents and passes a steam reference to that copy.
string - the string to create a stream for.
InputStream for the string's contents.
IllegalArgumentException - if string is null.public static String getSuffix(String filePath)
public static boolean isAncestorOf(File file,
File ancestor)
public static boolean isFileOutOfDate(URL url,
long expiryTime)
public static String makeSuffixForMimeType(String mimeType)
public static MappedByteBuffer mapFile(File file)
throws IOException
IOException
public static InputStream openFileOrResourceStream(String fileName,
Class c)
fileName - the path of the file to open, either absolute or relative to the classpath.c - the class that will be used to find a path relative to the classpath.
InputStream to the open file
IllegalArgumentException - if the file name is null.
WWRuntimeException - if an exception occurs or the file can't be found. The causing exception is
available via this exception's Throwable.initCause(Throwable) method.
public static ByteBuffer readFileToBuffer(File file)
throws IOException
IOException
public static ByteBuffer readStreamToBuffer(InputStream inputStream)
throws IOException
IOExceptionpublic static String readTextFile(File file)
String.
file - a File reference to the file to open and read.
String containing the contents of the file.
IllegalArgumentException - if the file is null.
public static ByteBuffer readURLContentToBuffer(URL url)
throws IOException
IOException
public static ByteBuffer readZipEntryToBuffer(File zipFile,
String entryName)
throws IOException
IOException
public static String replaceSuffix(String in,
String newSuffix)
public static boolean saveBuffer(ByteBuffer buffer,
File file)
throws IOException
IOException
public static boolean saveBuffer(ByteBuffer buffer,
File file,
boolean forceFilesystemWrite)
throws IOException
IOException
public static File saveBufferToTempFile(ByteBuffer buffer,
String suffix)
throws IOException
IOExceptionpublic static String stripIllegalFileNameCharacters(String s)
public static String stripLeadingSeparator(String s)
public static String stripLeadingZeros(String s)
public static String stripTrailingSeparator(String s)
public static void writeTextFile(String text,
File file)
String to a text file.
text - the String to write to the file.file - a File reference to the file to create.
IllegalArgumentException - if the text string or file is null.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||