Package mil.nga.geopackage.io
Class GeoPackageIOUtils
- java.lang.Object
- 
- mil.nga.geopackage.io.GeoPackageIOUtils
 
- 
 public class GeoPackageIOUtils extends Object Input / Output utility methods- Author:
- osbornb
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intCOPY_BUFFER_SIZECopy stream buffer chunk size in bytes
 - 
Constructor SummaryConstructors Constructor Description GeoPackageIOUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static FileaddFileExtension(File file, String extension)Add a the file extension to the filestatic StringaddFileExtension(String name, String extension)Add a the file extension to the namestatic voidcloseQuietly(Closeable closeable)Close the closeable quietlystatic voidcopyFile(File copyFrom, File copyTo)Copy a file to a file locationstatic voidcopyFile(File copyFrom, File copyTo, GeoPackageProgress progress)Copy a file to a file locationstatic voidcopyFile(File copyFrom, OutputStream copyTo)Copy a file to an output streamstatic voidcopyFile(File copyFrom, OutputStream copyTo, GeoPackageProgress progress)Copy a file to an output streamstatic voidcopyStream(InputStream copyFrom, File copyTo)Copy an input stream to a file locationstatic voidcopyStream(InputStream copyFrom, File copyTo, GeoPackageProgress progress)Copy an input stream to a file locationstatic voidcopyStream(InputStream copyFrom, OutputStream copyTo)Copy an input stream to an output streamstatic voidcopyStream(InputStream copyFrom, OutputStream copyTo, GeoPackageProgress progress)Copy an input stream to an output streamstatic byte[]fileBytes(File file)Get the file bytesstatic StringfileString(File file)Get the file stringstatic StringfileString(File file, String charsetName)Get the file stringstatic StringformatBytes(long bytes)Format the bytes into readable textstatic StringgetFileExtension(File file)Get the file extensionstatic StringgetFileExtension(String name)Get the file extensionstatic StringgetFileNameWithoutExtension(File file)Get the file name with the extension removedstatic StringgetFileNameWithoutExtension(String name)Get the file name with the extension removedstatic StringgetPathFileName(String path)Get the path file namestatic StringgetPathFileNameWithoutExtension(String path)Get the path file namestatic booleanhasFileExtension(File file)Check if the file has an extensionstatic booleanhasFileExtension(String name)Check if the name has an extensionstatic byte[]streamBytes(InputStream stream)Get the stream bytesstatic StringstreamString(InputStream stream)Get the stream string in UTF-8static StringstreamString(InputStream stream, String charsetName)Get the stream string
 
- 
- 
- 
Method Detail- 
getFileExtensionpublic static String getFileExtension(File file) Get the file extension- Parameters:
- file- file
- Returns:
- extension
 
 - 
getFileExtensionpublic static String getFileExtension(String name) Get the file extension- Parameters:
- name- name
- Returns:
- extension
- Since:
- 3.5.0
 
 - 
hasFileExtensionpublic static boolean hasFileExtension(File file) Check if the file has an extension- Parameters:
- file- file
- Returns:
- true if has extension
- Since:
- 3.0.2
 
 - 
hasFileExtensionpublic static boolean hasFileExtension(String name) Check if the name has an extension- Parameters:
- name- name
- Returns:
- true if has extension
- Since:
- 3.5.0
 
 - 
addFileExtensionpublic static File addFileExtension(File file, String extension) Add a the file extension to the file- Parameters:
- file- file
- extension- file extension
- Returns:
- new file with extension
- Since:
- 3.0.2
 
 - 
addFileExtensionpublic static String addFileExtension(String name, String extension) Add a the file extension to the name- Parameters:
- name- name
- extension- file extension
- Returns:
- new name with extension
- Since:
- 3.5.0
 
 - 
getFileNameWithoutExtensionpublic static String getFileNameWithoutExtension(File file) Get the file name with the extension removed- Parameters:
- file- file
- Returns:
- file name
 
 - 
getFileNameWithoutExtensionpublic static String getFileNameWithoutExtension(String name) Get the file name with the extension removed- Parameters:
- name- name
- Returns:
- file name
- Since:
- 3.5.0
 
 - 
getPathFileNamepublic static String getPathFileName(String path) Get the path file name- Parameters:
- path- file path
- Returns:
- file name
- Since:
- 6.2.0
 
 - 
getPathFileNameWithoutExtensionpublic static String getPathFileNameWithoutExtension(String path) Get the path file name- Parameters:
- path- file path
- Returns:
- file name
- Since:
- 6.2.0
 
 - 
copyFilepublic static void copyFile(File copyFrom, File copyTo) throws IOException Copy a file to a file location- Parameters:
- copyFrom- from file
- copyTo- to file
- Throws:
- IOException- upon failure
 
 - 
copyFilepublic static void copyFile(File copyFrom, File copyTo, GeoPackageProgress progress) throws IOException Copy a file to a file location- Parameters:
- copyFrom- from file
- copyTo- to file
- progress- progress tracker
- Throws:
- IOException- upon failure
- Since:
- 5.0.0
 
 - 
copyFilepublic static void copyFile(File copyFrom, OutputStream copyTo) throws IOException Copy a file to an output stream- Parameters:
- copyFrom- from file
- copyTo- to stream
- Throws:
- IOException- upon failure
- Since:
- 5.0.0
 
 - 
copyFilepublic static void copyFile(File copyFrom, OutputStream copyTo, GeoPackageProgress progress) throws IOException Copy a file to an output stream- Parameters:
- copyFrom- from file
- copyTo- to stream
- progress- progress tracker
- Throws:
- IOException- upon failure
- Since:
- 5.0.0
 
 - 
copyStreampublic static void copyStream(InputStream copyFrom, File copyTo) throws IOException Copy an input stream to a file location- Parameters:
- copyFrom- from file
- copyTo- to file
- Throws:
- IOException- upon failure
 
 - 
copyStreampublic static void copyStream(InputStream copyFrom, File copyTo, GeoPackageProgress progress) throws IOException Copy an input stream to a file location- Parameters:
- copyFrom- from file
- copyTo- to file
- progress- progress tracker
- Throws:
- IOException- upon failure
 
 - 
fileBytespublic static byte[] fileBytes(File file) throws IOException Get the file bytes- Parameters:
- file- input file
- Returns:
- file bytes
- Throws:
- IOException- upon failure
 
 - 
fileStringpublic static String fileString(File file) throws IOException Get the file string- Parameters:
- file- input file
- Returns:
- file string
- Throws:
- IOException- upon failure
- Since:
- 6.6.0
 
 - 
fileStringpublic static String fileString(File file, String charsetName) throws IOException Get the file string- Parameters:
- file- input file
- charsetName- character set name
- Returns:
- file string
- Throws:
- IOException- upon failure
- Since:
- 6.6.0
 
 - 
streamBytespublic static byte[] streamBytes(InputStream stream) throws IOException Get the stream bytes- Parameters:
- stream- input stream
- Returns:
- stream bytes
- Throws:
- IOException- upon failure
 
 - 
streamStringpublic static String streamString(InputStream stream) throws IOException Get the stream string in UTF-8- Parameters:
- stream- input stream
- Returns:
- stream string
- Throws:
- IOException- upon failure
- Since:
- 3.3.0
 
 - 
streamStringpublic static String streamString(InputStream stream, String charsetName) throws IOException Get the stream string- Parameters:
- stream- input stream
- charsetName- character set name
- Returns:
- stream string
- Throws:
- IOException- upon failure
- Since:
- 3.3.0
 
 - 
copyStreampublic static void copyStream(InputStream copyFrom, OutputStream copyTo) throws IOException Copy an input stream to an output stream- Parameters:
- copyFrom- from stream
- copyTo- to stream
- Throws:
- IOException- upon failure
 
 - 
copyStreampublic static void copyStream(InputStream copyFrom, OutputStream copyTo, GeoPackageProgress progress) throws IOException Copy an input stream to an output stream- Parameters:
- copyFrom- from stream
- copyTo- to stream
- progress- progress tracker
- Throws:
- IOException- upon failure
 
 - 
formatBytespublic static String formatBytes(long bytes) Format the bytes into readable text- Parameters:
- bytes- bytes
- Returns:
- bytes text
 
 - 
closeQuietlypublic static void closeQuietly(Closeable closeable) Close the closeable quietly- Parameters:
- closeable- closeable (stream, etc)
- Since:
- 2.0.2
 
 
- 
 
-