- * @return the time in milliseconds
- */
- static public long toTime(String displayTime) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
- return sdf.parse(displayTime).getTime();
- } catch (ParseException e) {
- return -1;
- }
- }
-
- /**
- * Convert the given {@link Image} object into a Base64 representation of
- * the same {@link Image}. object.
- *
- * @param image
- * the {@link Image} object to convert
- *
- * @return the Base64 representation
- *
- * @throws IOException
- * in case of IO error
- */
- static public String fromImage(BufferedImage image) throws IOException {
- return fromImage(image, null);
- }
-
- /**
- * Convert the given {@link Image} object into a Base64 representation of
- * the same {@link Image}. object.
- *
- * @param image
- * the {@link Image} object to convert
- * @param format
- * the image format to use to serialise it (default is PNG)
- *
- * @return the Base64 representation
- *
- * @throws IOException
- * in case of IO error
- */
- static public String fromImage(BufferedImage image, String format)
- throws IOException {
- if (format == null) {
- format = "png";
- }
-
- String imageString = null;
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- ImageIO.write(image, format, out);
- byte[] imageBytes = out.toByteArray();
-
- imageString = new String(Base64.encodeBytes(imageBytes));
-
- out.close();
-
- return imageString;
- }
-
- /**
- * Convert the given image into a Base64 representation of the same
- * {@link File}.
- *
- * @param in
- * the image to convert
+ * @return the number of milliseconds since the standard base time known as
+ * "the epoch", namely January 1, 1970, 00:00:00 GMT, or -1 in case
+ * of error