|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hp.hpl.jena.util.FileUtils
public class FileUtils
Field Summary | |
---|---|
static String |
encodingUTF8
Java name for UTF-8 encoding |
static String |
langN3
|
static String |
langNTriple
|
static String |
langTurtle
|
static String |
langXML
|
static String |
langXMLAbbrev
|
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static BufferedReader |
asBufferedUTF8(InputStream in)
Create a buffered reader that uses UTF-8 encoding |
static PrintWriter |
asPrintWriterUTF8(OutputStream out)
Create a print writer that uses UTF-8 encoding |
static Reader |
asUTF8(InputStream in)
Create a reader that uses UTF-8 encoding |
static Writer |
asUTF8(OutputStream out)
Create a writer that uses UTF-8 encoding |
static String |
decodeFileName(String s)
|
static String |
encodeFileName(String s)
Deprecated. Broken: use toURL() |
static String |
getDirname(String filename)
Get the directory part of a filename |
static String |
getFilenameExt(String filename)
Get the suffix part of a file name or a URL in file-like format. |
static String |
getScheme(String uri)
|
static File |
getScratchDirectory(String prefix)
Answer a File naming a freshly-created directory in the temporary directory. |
static String |
getTempDirectory()
|
static String |
guessLang(String urlStr)
Guess the language/type of model data If the URI ends ".rdf", it is assumed to be RDF/XML If the URI ends ".nt", it is assumed to be N-Triples If the URI ends ".ttl", it is assumed to be Turtle If the URI ends ".owl", it is assumed to be RDF/XML |
static String |
guessLang(String name,
String otherwise)
Guess the language/type of model data. |
static boolean |
isFile(String name)
Check whether 'name' is possibly a file reference |
static boolean |
isURI(String name)
Check whether a name is an absolute URI (has a scheme name) |
static BufferedReader |
openResourceFile(String filename)
Answer a BufferedReader than reads from the named resource file as UTF-8, possibly throwing WrappedIOExceptions. |
static InputStream |
openResourceFileAsStream(String filename)
Open an resource file for reading. |
static BufferedReader |
readerFromURL(String urlStr)
|
static String |
readWholeFileAsUTF8(InputStream in)
Read a whole stream as UTF-8 |
static String |
readWholeFileAsUTF8(String filename)
Read a whole file as UTF-8 |
static File |
tempFileName(String prefix,
String suffix)
create a temporary file that will be deleted on exit, and do something sensible with any IO exceptions - namely, throw them up wrapped in a JenaException. |
static String |
toFilename(String filenameOrURI)
Turn a file: URL or file name into a plain file name |
static String |
toURL(String filename)
Turn a plain filename into a "file:" URL |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String langXML
public static final String langXMLAbbrev
public static final String langNTriple
public static final String langN3
public static final String langTurtle
public static final String encodingUTF8
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static Reader asUTF8(InputStream in)
public static BufferedReader asBufferedUTF8(InputStream in)
public static Writer asUTF8(OutputStream out)
public static PrintWriter asPrintWriterUTF8(OutputStream out)
public static String guessLang(String name, String otherwise)
name
- URL to base the guess onotherwise
- Default guess
public static String guessLang(String urlStr)
urlStr
- URL to base the guess on
public static String toFilename(String filenameOrURI)
public static String decodeFileName(String s)
public static String toURL(String filename)
@Deprecated public static String encodeFileName(String s)
public static boolean isFile(String name)
name
-
public static boolean isURI(String name)
name
-
public static String getScheme(String uri)
public static String getDirname(String filename)
filename
-
public static String getFilenameExt(String filename)
public static File tempFileName(String prefix, String suffix)
prefix
- the prefix for File.createTempFilesuffix
- the suffix for File.createTempFile
public static File getScratchDirectory(String prefix)
prefix
- the prefix for the directory name
public static String getTempDirectory()
public static BufferedReader openResourceFile(String filename)
public static InputStream openResourceFileAsStream(String filename) throws FileNotFoundException
FileNotFoundException
public static BufferedReader readerFromURL(String urlStr)
public static String readWholeFileAsUTF8(String filename) throws IOException
filename
-
IOException
public static String readWholeFileAsUTF8(InputStream in) throws IOException
in
- InputStream to be read
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |