Package ch.software_atelier.simpleflex
Class Utils
java.lang.Object
ch.software_atelier.simpleflex.Utils
This Class holds some static Utility-methods
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.json.JSONObjectstatic StringgetFileExtension(String fileName) static Stringstatic StringgetMimeFromFilePath(String path) static StringgetResource(String name) static voidstatic longstatic byte[]Reads all bytes of a BuferedInputStream untill a NewLine-Char and returns the readed data as a String.static byte[]static StringreadUntilNewLine(BufferedInputStream is, boolean trim) Reads all bytes of a BuferedInputStream untill a NewLine-Char and returns the readed data as a String.static voidregisterMime(String suffix, String mime) static StringremoveNonEscaped(String src, char remove, char escape) static String[]splitHeader(String header) tokenizeByIgnoringEnclosure(String src, char separator, char enclosure)
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getMimeFromFilePath
-
registerMime
-
getResource
-
main
-
readBytesUntilNewLine
Reads all bytes of a BuferedInputStream untill a NewLine-Char and returns the readed data as a String. This Method blocks, if no data is aviable and only stops on a newline- or EOF-char!- Parameters:
is- The InputStream- Returns:
- The readed Data or null on EOF.
- Throws:
IOException
-
readUntilNewLine
Reads all bytes of a BuferedInputStream untill a NewLine-Char and returns the readed data as a String. This Method blocks, if no data is aviable and only stops on a newline- or EOF-char!- Parameters:
is- The InputStreamtrim- trims the String- Returns:
- The readed Data or null on EOF.
- Throws:
IOException
-
splitHeader
-
getFileExtension
-
getHTTPDateHeaderValue
-
readFile
-
tokenize
-
parseLong
-
file2JSON
- Throws:
IOExceptionorg.json.JSONException
-
tokenizeByIgnoringEnclosure
-
removeNonEscaped
-