{"id":20756858,"url":"https://github.com/jesusbmx/juno","last_synced_at":"2026-04-13T11:32:40.409Z","repository":{"id":155765900,"uuid":"332269153","full_name":"jesusbmx/juno","owner":"jesusbmx","description":"Herramientas de desarrollo para java y Android","archived":false,"fork":false,"pushed_at":"2025-10-01T18:14:43.000Z","size":15065,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-21T21:28:35.495Z","etag":null,"topics":["android","arrays","async-await","base64","concurrency","converts","file-basename","file-extension","file-read","file-write","formats","ioutils","java","numbers","round-avoid","strings","utils"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jesusbmx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"jesusbmx"}},"created_at":"2021-01-23T17:33:38.000Z","updated_at":"2025-10-01T18:13:03.000Z","dependencies_parsed_at":"2024-04-07T20:37:29.834Z","dependency_job_id":"7693fa7b-4103-4319-9b4c-ef69ef85e74b","html_url":"https://github.com/jesusbmx/juno","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jesusbmx/juno","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Fjuno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Fjuno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Fjuno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Fjuno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jesusbmx","download_url":"https://codeload.github.com/jesusbmx/juno/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusbmx%2Fjuno/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31751379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","arrays","async-await","base64","concurrency","converts","file-basename","file-extension","file-read","file-write","formats","ioutils","java","numbers","round-avoid","strings","utils"],"created_at":"2024-11-17T09:35:39.488Z","updated_at":"2026-04-13T11:32:40.394Z","avatar_url":"https://github.com/jesusbmx.png","language":"Java","funding_links":["https://github.com/sponsors/jesusbmx"],"categories":[],"sub_categories":[],"readme":"Juno\n========\nJuno is a utility library designed to simplify common tasks in Java and Android development. It provides a set of helpful methods for data conversion, string manipulation, collections handling, file I/O, and more.\n\n## Installation\n\nTo include Juno in your project using Gradle, add the following dependency:\n```\ndependencies {\n  implementation 'com.github.jesusbmx:juno:1.0.6'\n}\n```\n\nAlternatively, you can download the JAR file directly from [JitPack](https://jitpack.io/#jesusbmx/juno):\n\nDownload [juno.jar](https://jitpack.io/com/github/jesusbmx/juno/1.0.6/juno-1.0.6.jar)\n\n\n## Documentation\n\n### Convert\n```java\nint i = Convert.toInt(\"1\", -1); // 1\nfloat f = Convert.toFloat(\"1.1\"); // 1.1f\ndouble d = Convert.toDouble(\"2.2\"); // 2.2d\ndouble l = Convert.toLong(\"1000\"); // 1000L\nString str = Convert.toString(f, \"\"); // \"1.1\"\nboolean bool = Convert.toBool(\"true\"); // true\n```\n\n### Base64\nEncoding and decoding in Base64:\n```java\nString encodeBase64 = Convert.toBase64(\"Hello world\");\nSystem.out.println(encodeBase64); // SGVsbG8gd29ybGQ=\n```\n\n```java\nString decodeBase64 = Convert.fromBase64(encodeBase64);\nSystem.out.println(decodeBase64); // Hello world\n```\n\n### Strings\nValidate if a string is empty:\n```java\nString txt = null;\nif (Strings.isEmpty(txt)) {\n  System.out.println(\"txt is empty\");\n}\n```\n    \nAssign default value if null:\n```java\ntxt = Validate.ifNull(txt, \"Hello world\");\nSystem.out.printf(\"txt = '%s'\\n\", txt); // txt = 'hello world'\n```\n\nAbbreviate a string:\n```java\ntxt = Strings.abbreviate(txt, 7);\nSystem.out.printf(\"txt = '%s'\\n\", txt); // txt = 'hello...'\n```\n\nTrim and capitalize a string:\n```java\nString name = \"jesus   \";\nname = Strings.trim(name);\nname = Strings.capitalize(name);\nSystem.out.printf(\"name = '%s'\\n\", name);  // name = 'John'\n```\n\nGet a substring between two characters:\n```java\nSystem.out.println(Strings.subStr(\"[Hello world]\", \"[\", \"]\")); // Hello world\n```\n\n### Numbers\nValidate if a value is numeric and convert it:\n```java\nString number = \"-892768237.50\";\nif (Numbers.isNumber(number)) {\n  System.out.printf(\"'%f' is number\\n\", Convert.toDouble(number)); // '-892768237.500000' is number\n} else {\n  System.out.printf(\"'%s' not is number\\n\", number);\n}\n```\n\nConvert numeric strings to integers and floats:\n```java   \nString str = \"10.80\";\n\nint i = Convert.toInt(str);\nSystem.out.printf(\"i = '%d'\\n\", i); // i = '10'\n\nfloat f = Convert.toFloat(str);\nSystem.out.printf(\"f = '%f'\\n\", f); // f = '10.800000'\n```\n\nRound a number to a specified number of decimal places:\n```java\ndouble round = Numbers.roundAvoid(948.856099955012, 2);\nSystem.out.println(round); // 948.86\n```\n\n\n### Lists, Arrays\n```java\nList\u003cString\u003e strList = Lists.listOf(\"1\", \"2\", \"3\", \"7\", \"9\");\nList\u003cInteger\u003e intList = Lists.map(strList, (String it) -\u003e Convert.toInt(it) );\n\nif (Lists.hasIndex(strList, 2)) {\n    System.out.printf(\"list[2] = '%s'\\n\", strList.get(2)); // list[2] = '3'\n}\n\nif (Lists.isEmpty(strList)) {\n    System.out.println(\"list is empty\");\n}\n\nSystem.out.println(Lists.getValueOrDefault(strList, 50, \"defaultVal\")); // defaultVal\n\nSystem.out.println(Strings.join(strList)); // 1,2,3,7,9\nSystem.out.println(Strings.join(strList, (element) -\u003e \"\\\"\" + element.toString() + \"\\\"\" )); // \"1\",\"2\",\"3\",\"7\",\"9\"\n\nboolean some = Lists.some(strList, (element) -\u003e element.equals(\"7\") );\nSystem.out.println(some); // true\n\nboolean every = Lists.every(intList, (element) -\u003e element % 2 == 0 );\nSystem.out.println(every); // false\n\nString find = Lists.find(strList, (element) -\u003e element.equals(\"9\") );\nSystem.out.println(find); // 9\n\nList\u003cInteger\u003e filter = Lists.filter(intList, (element) -\u003e element \u003e 5 );\nSystem.out.println(Strings.join(filter, \",\")); // 7,9\n\nList\u003cString\u003e fill = Lists.fill(strList, \"z\");\nSystem.out.println(Strings.join(fill, \",\")); // z,z,z,z,z\n```\n\n\n### Maps\nCreate and manipulate maps:\n```java\nfinal Map\u003cString, Integer\u003e map = Maps.of(\n    \"one\", 1, \n    \"two\", 2, \n    \"three\", 3\n);\n\nSystem.out.println(map); // {one=1, two=2, three=3}\nSystem.out.println(Maps.getValueOrDefault(map, \"one\", -1)); // 1\n\nMap\u003cInteger, String\u003e convertedMap2 = Maps.convert(\n    map,\n    entry -\u003e entry.getValue(),\n    entry -\u003e entry.getKey() + \"-\" + entry.getValue()\n);\nSystem.out.println(convertedMap2); // {1=one-1, 2=two-2, 3=three-3}\n```\n\nGet values from a map with default values:\n```java\nint intValue = Maps.getInt(map, \"one\", 0);\nSystem.out.println(intValue); // 1\n\nfloat floatValue = Maps.getFloat(map, \"nonexistentKey\", 0.0f);\nSystem.out.println(floatValue); // 0.0\n\ndouble doubleValue = Maps.getDouble(map, \"two\", 2.5);\nSystem.out.println(doubleValue); // 2.0\n\nboolean boolValue = Maps.getBoolean(map, \"nonexistentKey\", false);\nSystem.out.println(boolValue); // false\n\n```\n\n### Date\n```java\nString sDate = \"2023-04-30 19:10:02\";\n        \nCalendar date = Dates.parseCalendar(sDate, \"yyyy-MM-dd\");\nSystem.out.println(Dates.dateTimeFormat(date)); // 2023-04-30 00:00:00\n\nDate dateTime = Dates.parseDate(sDate, \"yyyy-MM-dd HH:mm:ss\");\nSystem.out.println(Dates.dateTimeFormat(dateTime)); // 2023-04-30 19:10:02\n\n\nSystem.out.println(Dates.dateFormat(new Date())); // 2023-05-03\nSystem.out.println(Dates.dateTimeFormat(new Date())); // 2023-05-03 12:31:47\nSystem.out.println(Dates.format(\"yyyy-MM-dd HH:mm:ss\", new Date())); // 2023-05-03 12:31:47\n\n\nCalendar cDate = Dates.calendarWithoutTime(); // get date without time\nSystem.out.println(Dates.dateTimeFormat(cDate)); // 2023-05-03 00:00:00\n\nCalendar cDateTime = Dates.calendarWithTime(); // get date and time\nSystem.out.println(Dates.dateTimeFormat(cDateTime)); // 2023-05-03 12:31:47\n\n/*Date date_iso_8601 = Dates.parseDate(\"2023-06-20T19:18:11.000Z\", \n                \"yyyy-MM-dd'T'HH:mm:ss.SSSXXX\");*/\nDate date_iso_8601 = Dates.parseIso8601Compat(\"2023-06-20T19:18:11.000Z\");\n\nSystem.out.println(Dates.dateTimeFormat(date_iso_8601)); // 2023-06-20 13:18:11\n```\n\n\n### Async / Sync\n\nDefining a task\n```java\nTask\u003cString\u003e read(final File file) {\n  return new AsyncTask\u003c\u003e(() -\u003e {\n    //throw new Exception(\"error\");\n    return Files.readString(file);\n  });\n}\n```\n\nRun tasks asynchronously\n\nIt runs in the background and reports the result via callbacks:\n\n```java\nFile file = new File(\"/home/user/a.txt\");\n\nread(file).async(\n  (String result) -\u003e {\n    System.out.println(result);\n  }, \n  (Exception error) -\u003e {\n    System.err.println(error);\n  }\n);\n```\n\nRun tasks synchronously\n\nIt runs in a blocking manner and returns the result directly or throws an exception:\n\n```java\ntry {\n  File file = new File(\"/home/user/a.txt\");\n\n  String result = read(file).sync();\n  System.out.println(result);\n\n} catch(Exception error) {\n  System.err.println(error);\n}\n```\n\n### Async Sender\n\nAsyncSender allows you to implement a task by manually resolving or rejecting its result:\n\n```java\nTask\u003cString\u003e read(final File file) {\n  return new AsyncSender\u003c\u003e((sender) -\u003e {\n    //sender.reject(throw new Exception(\"error\"));\n    String result = Files.readString(file);\n    sender.resolve(result);\n  });\n}\n```\n\n### Abstract Async\n```java\nTask\u003cString\u003e read(final File file) {\n  return new AbstractTask\u003cString\u003e() {\n    @Override\n    public String call() throws Exception {\n      //throw new Exception(\"error\");\n      return Files.readString(file);\n    }\n };\n}\n```\n\n\n### EventManager\n```java\nEventManager receiver = EventManager.get(\"MyHandler\");\nreceiver.on(\"log\", (EventMessage\u003cString\u003e evt) -\u003e {\n    System.out.println(evt.getValue());\n});\n\nEventManager sender = EventManager.get(\"MyHandler\");\nsender.send(\"log\", \"Hola mundo\");\n```\n\n```java\nEventManager receiver = EventManager.get(\"MyHandler\");\nreceiver.once(\"status\", (EventMessage\u003cInteger\u003e evt) -\u003e {\n    System.out.println(evt.getValue());\n});\n\nEventManager sender = EventManager.get(\"MyHandler\");\nsender.send(\"status\", 200);\n```\n\n### Paths\n```java\nString basePath = \"/home\";\n\nSystem.out.println(Paths.join('/', Arrays.of(\n    basePath, \"User/Desktop\", \"file.txt\"\n))); // /home/User/Desktop/file.txt\n\nbasePath = \"/home/User/Documents/\";\n\nSystem.out.println(Paths.join('/', Arrays.of(\n    basePath, \"file.txt\"\n))); // /home/User/Documents/file.txt\n\nbasePath = \"/home/User\";\n\nSystem.out.println(Paths.join('/', Arrays.of(\n    basePath, \"Downloads\", \"file.txt\"\n))); // /home/User/Downloads/file.txt\n\nSystem.out.println(Paths.join('/', Arrays.of(\n    \"/home\", \"User2\", \"Downloads\", \"file.txt\"\n))); // /home/User2/Downloads/file.txt\n\nSystem.out.println(Paths.join('/', Arrays.of(\n    \"/home\", \"User2\", \"Downloads\"\n))); // /home/User2/Downloads\n```\n\n### IO\n```java\nString path = \"/etc/hola.txt\";\nFile f = new File(path);\n\nFiles.write(f, \"Hola mundo\\n\", /*append*/true, \"UTF-8\");\n\nString str = Files.readString(f);\nSystem.out.println(str);\n\nSystem.out.printf(\"parent: %s\\n\", Files.getParent(path));\nSystem.out.printf(\"name: %s\\n\", Files.getName(path));\nSystem.out.printf(\"extension: %s\\n\", Files.getExtension(path));\nSystem.out.printf(\"base name: %s\\n\", Files.getBaseName(path));\n```\n\n```markdown\n\u003e Hola mundo\n\u003e\n\u003e parent: /etc/\n\u003e name: hola.txt\n\u003e extension: txt\n\u003e base name: hola\n```\n\nRead bytes.\n```java\nbyte[] bytes = Files.readByteArray(new File(\"/etc/hola.txt\"));\n```\n\nCopy\n```java\nFiles.copy(\"/etc/hola.txt\", \"/etc/hola-copy.txt\");\n```\n\n```java\nFileInputStream in = null;\nFileOutputStream out = null;\ntry {\n  in = new FileInputStream(\"/etc/hola.txt\");\n  out = new FileOutputStream(\"/etc/hola-copy.txt\");\n  Files.copy(in, out);\n\n} finally {\n  Files.closeQuietly(in);\n  Files.closeQuietly(out);\n}\n```\n\n### Validate\n```java\n\nString a = null;\nString b = \"b\";\nSystem.out.println(Validate.eq(a, b));\nSystem.out.println(Validate.isNull(null));\nSystem.out.println(Validate.isNotNull(null));\n```\n\n```markdown\n\u003e false\n\u003e true\n\u003e false\n```\n\nLicense\n=======\n\n    Copyright 2018 juno, Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusbmx%2Fjuno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesusbmx%2Fjuno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusbmx%2Fjuno/lists"}