public class GeoPackageIOUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
COPY_BUFFER_SIZE
Copy stream buffer chunk size in bytes
|
| Constructor and Description |
|---|
GeoPackageIOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static File |
addFileExtension(File file,
String extension)
Add a the file extension to the file
|
static void |
closeQuietly(Closeable closeable)
Close the closeable quietly
|
static void |
copyFile(File copyFrom,
File copyTo)
Copy a file to a file location
|
static void |
copyStream(InputStream copyFrom,
File copyTo)
Copy an input stream to a file location
|
static void |
copyStream(InputStream copyFrom,
File copyTo,
GeoPackageProgress progress)
Copy an input stream to a file location
|
static void |
copyStream(InputStream copyFrom,
OutputStream copyTo)
Copy an input stream to an output stream
|
static void |
copyStream(InputStream copyFrom,
OutputStream copyTo,
GeoPackageProgress progress)
Copy an input stream to an output stream
|
static byte[] |
fileBytes(File file)
Get the file bytes
|
static String |
formatBytes(long bytes)
Format the bytes into readable text
|
static String |
getFileExtension(File file)
Get the file extension
|
static String |
getFileNameWithoutExtension(File file)
Get the file name with the extension removed
|
static boolean |
hasFileExtension(File file)
Check if the file has an extension
|
static byte[] |
streamBytes(InputStream stream)
Get the stream bytes
|
static String |
streamString(InputStream stream)
Get the stream string in UTF-8
|
static String |
streamString(InputStream stream,
String charsetName)
Get the stream string
|
public static int COPY_BUFFER_SIZE
public static String getFileExtension(File file)
file - filepublic static boolean hasFileExtension(File file)
file - filepublic static File addFileExtension(File file, String extension)
file - fileextension - file extensionpublic static String getFileNameWithoutExtension(File file)
file - filepublic static void copyFile(File copyFrom, File copyTo) throws IOException
copyFrom - from filecopyTo - to fileIOException - upon failurepublic static void copyStream(InputStream copyFrom, File copyTo) throws IOException
copyFrom - from filecopyTo - to fileIOException - upon failurepublic static void copyStream(InputStream copyFrom, File copyTo, GeoPackageProgress progress) throws IOException
copyFrom - from filecopyTo - to fileprogress - progress trackerIOException - upon failurepublic static byte[] fileBytes(File file) throws IOException
file - input fileIOException - upon failurepublic static byte[] streamBytes(InputStream stream) throws IOException
stream - input streamIOException - upon failurepublic static String streamString(InputStream stream) throws IOException
stream - input streamIOException - upon failurepublic static String streamString(InputStream stream, String charsetName) throws IOException
stream - input streamcharsetName - character set nameIOException - upon failurepublic static void copyStream(InputStream copyFrom, OutputStream copyTo) throws IOException
copyFrom - from streamcopyTo - to streamIOException - upon failurepublic static void copyStream(InputStream copyFrom, OutputStream copyTo, GeoPackageProgress progress) throws IOException
copyFrom - from streamcopyTo - to streamprogress - progress trackerIOException - upon failurepublic static String formatBytes(long bytes)
bytes - bytespublic static void closeQuietly(Closeable closeable)
closeable - closeable (stream, etc)Copyright © 2019 National Geospatial-Intelligence Agency. All rights reserved.