{"id":15494886,"url":"https://github.com/fracpete/inetutils4j","last_synced_at":"2025-10-11T23:13:21.310Z","repository":{"id":57719805,"uuid":"135086457","full_name":"fracpete/inetutils4j","owner":"fracpete","description":"Helper classes for internet related operations, like proxy settings and downloading files.","archived":false,"fork":false,"pushed_at":"2020-10-13T01:02:59.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-19T12:15:44.706Z","etag":null,"topics":["downloader","internet","java","proxy-configuration"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fracpete.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-27T22:35:05.000Z","updated_at":"2020-10-13T01:02:54.000Z","dependencies_parsed_at":"2022-09-13T13:02:12.043Z","dependency_job_id":null,"html_url":"https://github.com/fracpete/inetutils4j","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Finetutils4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Finetutils4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Finetutils4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fracpete%2Finetutils4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fracpete","download_url":"https://codeload.github.com/fracpete/inetutils4j/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068301,"owners_count":20718503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["downloader","internet","java","proxy-configuration"],"created_at":"2024-10-02T08:15:31.231Z","updated_at":"2025-10-11T23:13:16.257Z","avatar_url":"https://github.com/fracpete.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inetutils4j\nHelper classes for internet related operations, like proxy settings and \ndownloading files.\n\n## API\n\n### Proxy\nThere are three types of proxies supported:\n* HTTP\n* FTP\n* SOCKS\n\nUse the `com.github.fracpete.inetutils4j.api.Proxy` class to set or query \ncurrent proxy settings:\n\n```java\nimport com.github.fracpete.inetutils4j.api.Proxy;\nimport com.github.fracpete.inetutils4j.api.Proxy.ProxyType;\n...\nProxy.setProxy(ProxyType.HTTP, \"http://proxy.example.com\", 3128);\n``` \n\nYou can also supply the port in the URL:\n\n```java\nimport com.github.fracpete.inetutils4j.api.Proxy;\nimport com.github.fracpete.inetutils4j.api.Proxy.ProxyType;\n...\nProxy.setProxy(ProxyType.HTTP, \"http://proxy.example.com:3128\");\n``` \n\nIf you need to supply a user and password for the proxy, use this:\n\n```java\nimport com.github.fracpete.inetutils4j.api.Proxy;\nimport com.github.fracpete.inetutils4j.api.Proxy.ProxyType;\n...\nProxy.setProxy(ProxyType.HTTP, \"http://USER:PASSWORD@proxy.example.com:3128\");\n``` \n\n\n### Downloading files\n\nThe `download` method of the `com.github.fracpete.inetutils4j.api.Internet`\nclass performs the actual download. Whether you want to capture any output\nfrom running it in verbose, is handled by an instance of \n`com.github.fracpete.inetutils4j.core.OutputCapture`. Use `NullCapture`\nto avoid any output or `DefaultCapture` to simply output to stdout/stderr.\n\n```java\nimport com.github.fracpete.inetutils4j.api.Internet;\nimport com.github.fracpete.inetutils4j.core.DefaultCapture;\n...\nString msg = Internet.download(\n  \"http://myserver.example.com/myfile.txt\",\n  \"/home/user/myfile.txt\",\n  true,\n  new DefaultCapture());\nif (msg != null)\n  System.err.println(\"An error occurred:\\n\" + msg);\n```\n\n**NB:** The `download` method automatically handles redirects.\n\n\n### Downloading binary data\n\nThe `binaryContent` method of the `com.github.fracpete.inetutils4j.api.Internet`\nclass performs the download of a remote resource. Whether you want to capture any output\nfrom running it in verbose, is handled by an instance of \n`com.github.fracpete.inetutils4j.core.OutputCapture`. Use `NullCapture`\nto avoid any output or `DefaultCapture` to simply output to stdout/stderr.\n\n```java\nimport com.github.fracpete.inetutils4j.api.Internet;\nimport com.github.fracpete.inetutils4j.core.DefaultCapture;\n...\nbyte[] data = Internet.binaryContent(\n  \"http://myserver.example.com/myfile.txt\",\n  true,\n  new DefaultCapture());\nif (data == null)\n  System.err.println(\"An error occurred!\");\nelse\n  System.out.println(data.length + \" bytes downloaded\");\n```\n\n**NB:** The `binaryContent` method automatically handles redirects.\n\n\n### Downloading textual data\n\nThe `textualContent` method of the `com.github.fracpete.inetutils4j.api.Internet`\nclass performs the download of a remote resource. Whether you want to capture any output\nfrom running it in verbose, is handled by an instance of \n`com.github.fracpete.inetutils4j.core.OutputCapture`. Use `NullCapture`\nto avoid any output or `DefaultCapture` to simply output to stdout/stderr.\n\n```java\nimport com.github.fracpete.inetutils4j.api.Internet;\nimport com.github.fracpete.inetutils4j.core.DefaultCapture;\n...\nString html = Internet.textualContent(\n  \"http://myserver.example.com/myfile.txt\",\n  \"ISO-8859-1\",\n  true,\n  new DefaultCapture());\nif (html == null)\n  System.err.println(\"An error occurred!\");\nelse\n  System.out.println(html);\n```\n\n**NB:** The `textualContent` method automatically handles redirects.\n\n\n## Command-line tools\n\n### Download\n```\nusage: com.github.fracpete.inetutils4j.tools.Download\n       [-h] -r REMOTE -l LOCAL [-v] [--http_proxy HTTP_PROXY]\n       [--ftp_proxy FTP_PROXY] [--socks_proxy SOCKS_PROXY]\n\nAllows the download of remote files.\nIf proxies should require user/password, then  you need to include these in\nthe URL. For instance, for a HTTP proxy, use this format:\n  http://USER:PASSWORD@proxy.example.com:3128/\n\noptional arguments:\n  -h, --help             show this help message and exit\n  -r REMOTE, --remote REMOTE\n                         The URL of the remote file to download\n  -l LOCAL, --local LOCAL\n                         The local file to download the remote file to.\n  -v, --verbose          increase verbosity\n  --http_proxy HTTP_PROXY\n                         The URL of the HTTP proxy to use (including port)\n  --ftp_proxy FTP_PROXY  The URL of the FTP proxy to use (including port)\n  --socks_proxy SOCKS_PROXY\n                         The URL of the socks proxy to use (including port)\n```\n\n## Maven\n\nAdd the following artifact to your dependencies of your `pom.xml`:\n\n```xml\n    \u003cdependency\u003e\n      \u003cgroupId\u003ecom.github.fracpete\u003c/groupId\u003e\n      \u003cartifactId\u003einetutils4j\u003c/artifactId\u003e\n      \u003cversion\u003e0.0.2\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\n## Releases\n\nThe following releases are available:\n\n* [0.0.2](https://github.com/fracpete/inetutils4j/releases/download/inetutils4j-0.0.2/inetutils4j-0.0.2-spring-boot.jar)\n* [0.0.1](https://github.com/fracpete/inetutils4j/releases/download/inetutils4j-0.0.1/inetutils4j-0.0.1-spring-boot.jar)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffracpete%2Finetutils4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffracpete%2Finetutils4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffracpete%2Finetutils4j/lists"}