|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eaglei.repository.util.Utils
public class Utils
Utility methods
| Method Summary | |
|---|---|
static java.lang.String |
collectionDeepToString(java.util.Collection<? extends java.lang.Object> c)
Returns a string representation of the "deep contents" of the specified Collection, rendering each element with its toString(). |
static java.lang.String |
contentTypeGetCharset(java.lang.String ct,
java.lang.String dflt)
Extracts the character set specified with the content-type value. |
static java.lang.String |
contentTypeGetMIMEType(java.lang.String ct)
Extracts the MIME type specified with the content-type value. |
static void |
copyStream(java.io.InputStream in,
java.io.OutputStream out)
The canonical file copy loop. |
static java.lang.String |
escapeHTMLAttribute(java.lang.String in)
Escape a character string for HTML or XML attribute value: (assumes you're using double-quotes to delineate the value) 1. |
static org.openrdf.model.URI |
getHomeGraph(org.openrdf.repository.RepositoryConnection rc,
org.openrdf.model.URI resource)
Get a resource instance's home graph, ideally where its *asserted* rdf:type statements live - inferred types don't count. |
static java.lang.String |
getMavenVersionFromJar(java.lang.String jarURLspec)
Get the Maven version string, if available, from a resource URL containing a Jar archive. |
static java.lang.String |
getVersionInfo(org.openrdf.repository.RepositoryConnection rc,
org.openrdf.model.URI subject,
org.openrdf.model.URI graph)
Get the owl:versionInfo value (as String) for the given subject and named graph. |
static boolean |
isValidURI(java.lang.String s)
Test whether a string is a well-formed-enough absolute URI that it will not cause createURI to fail. |
static java.lang.String |
join(java.lang.String glue,
java.lang.String[] as)
|
static java.lang.String |
makeContentType(java.lang.String mimeType,
java.lang.String charset)
Combine MIME type expression with charset string (IFF not already present), and return the result. |
static java.lang.String |
makePreciseHTTPDate(java.util.Date d)
Returns a Date formatted in a more precise version of the standard HTTP date format - the same as the conventional standard format but with milliseconds added to the time. |
static boolean |
parseBooleanParameter(java.lang.String name,
java.lang.String argName,
boolean required,
boolean defaultValue)
Special query arg parser for args with boolean values. |
static java.lang.Enum |
parseKeywordArg(java.lang.Class et,
java.lang.String name,
java.lang.String argName,
boolean required,
java.lang.Enum defaultValue)
Parse a query arg value that is supposed to belong to an Enum set. |
static org.openrdf.model.URI |
parseURI(java.lang.String s,
java.lang.String argName,
boolean required)
Translates string to URI with sanity check. |
static javax.xml.datatype.XMLGregorianCalendar |
parseXMLDate(java.lang.String raw)
|
static java.lang.String |
prettyPrint(org.openrdf.query.Dataset ds)
Formatted human-readable view of Dataset contents which works even when some members are null. |
static java.lang.String |
toString(byte[] ba)
Like Arrays.toString() but prints bytes in hex instead of signed decimal for easier debugging of char strings. |
static java.lang.String |
urlEncode(java.lang.String in)
Returns an URL-encoded UTF8 encoding of the string. |
static java.lang.String |
valueAsString(org.openrdf.model.Value val)
Return the "most readable" string representation of a Sesame RDF Value object - Value can be URI, BNode, or Literal; in the case of a Literal it just returns hte string content, no datatype or language annotations. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void copyStream(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
in - source, a InputStream object.out - destination, a OutputStream object.
java$io$IOException - if anything goes wrong.
java.io.IOExceptionpublic static java.lang.String prettyPrint(org.openrdf.query.Dataset ds)
ds - a Dataset object.
String object.public static boolean isValidURI(java.lang.String s)
s - possible URI
public static org.openrdf.model.URI parseURI(java.lang.String s,
java.lang.String argName,
boolean required)
s - possible URIargName - name of parameter for error messagesrequired - true if arg is required
public static java.lang.Enum parseKeywordArg(java.lang.Class et,
java.lang.String name,
java.lang.String argName,
boolean required,
java.lang.Enum defaultValue)
et - the enumerated type classname - value of the argumentargName - name of the argument, e.g. parameter namerequired - when true this arg MUST have a value.defaultValue - default to subsitute when arg is not required and missing
BadRequestException - if arg is missing or illegal
public static boolean parseBooleanParameter(java.lang.String name,
java.lang.String argName,
boolean required,
boolean defaultValue)
name - value of the argumentargName - name of the argument, e.g. parameter namerequired - when true this arg MUST have a value.defaultValue - default to subsitute when arg is not required and missing
BadRequestException - if arg is missing or illegalpublic static javax.xml.datatype.XMLGregorianCalendar parseXMLDate(java.lang.String raw)
public static java.lang.String makeContentType(java.lang.String mimeType,
java.lang.String charset)
public static java.lang.String contentTypeGetCharset(java.lang.String ct,
java.lang.String dflt)
public static java.lang.String contentTypeGetMIMEType(java.lang.String ct)
public static java.lang.String toString(byte[] ba)
public static java.lang.String valueAsString(org.openrdf.model.Value val)
val - incoming Value object
public static java.lang.String urlEncode(java.lang.String in)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String escapeHTMLAttribute(java.lang.String in)
in - the source string
public static java.lang.String getMavenVersionFromJar(java.lang.String jarURLspec)
throws java.io.IOException
jarURLspec - the URL where the jar may be found
java.io.IOException
public static java.lang.String getVersionInfo(org.openrdf.repository.RepositoryConnection rc,
org.openrdf.model.URI subject,
org.openrdf.model.URI graph)
throws org.openrdf.repository.RepositoryException
org.openrdf.repository.RepositoryException
public static org.openrdf.model.URI getHomeGraph(org.openrdf.repository.RepositoryConnection rc,
org.openrdf.model.URI resource)
throws org.openrdf.repository.RepositoryException
request - resource - - the URI of the resorce
org.openrdf.repository.RepositoryExceptionpublic static java.lang.String collectionDeepToString(java.util.Collection<? extends java.lang.Object> c)
c - the collection to print
public static java.lang.String makePreciseHTTPDate(java.util.Date d)
d - the Date to format
public static java.lang.String join(java.lang.String glue,
java.lang.String[] as)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||