{"id":28684940,"url":"https://github.com/node-modules/java.io","last_synced_at":"2025-09-23T15:55:38.505Z","repository":{"id":15624583,"uuid":"18361330","full_name":"node-modules/java.io","owner":"node-modules","description":"A Node.js implement of \"java.io.InputObjectStream.readObject()\" and \"java.io.OutputObjectStream.writeObject()\"","archived":false,"fork":false,"pushed_at":"2023-01-09T18:30:01.000Z","size":292,"stargazers_count":32,"open_issues_count":8,"forks_count":8,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-09-21T10:38:16.240Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","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":"2014-04-02T09:33:12.000Z","updated_at":"2024-09-04T07:54:26.000Z","dependencies_parsed_at":"2023-01-13T18:30:54.184Z","dependency_job_id":null,"html_url":"https://github.com/node-modules/java.io","commit_stats":null,"previous_names":["node-modules/java.io","alibaba-archive/java.io"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/node-modules/java.io","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjava.io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjava.io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjava.io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjava.io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/java.io/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjava.io/sbom","scorecard":{"id":692019,"data":{"date":"2025-08-11","repo":{"name":"github.com/node-modules/java.io","commit":"c26e43929342485b660e2b6589faa563d64d46a8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":2,"reason":"Found 6/25 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T02:31:05.849Z","repository_id":15624583,"created_at":"2025-08-22T02:31:05.850Z","updated_at":"2025-08-22T02:31:05.850Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276604088,"owners_count":25671758,"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","status":"online","status_checked_at":"2025-09-23T02:00:09.130Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-06-14T03:08:04.637Z","updated_at":"2025-09-23T15:55:38.499Z","avatar_url":"https://github.com/node-modules.png","language":"JavaScript","readme":"# java.io\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![codecov](https://codecov.io/gh/node-modules/java.io/branch/master/graph/badge.svg)](https://codecov.io/gh/node-modules/java.io)\n[![David][david-image]][david-url]\n\n[npm-image]: https://img.shields.io/npm/v/java.io.svg?style=flat\n[npm-url]: https://npmjs.org/package/java.io\n[travis-image]: https://img.shields.io/travis/node-modules/java.io.svg?style=flat\n[travis-url]: https://travis-ci.org/node-modules/java.io\n[david-image]: https://img.shields.io/david/node-modules/java.io.svg?style=flat\n[david-url]: https://david-dm.org/node-modules/java.io\n\nA node implement of \"java.io.InputObjectStream.readObject()\" and \"java.io.OutputObjectStream.writeObject()\".\n\n## Protocol\n\n- [Object Serialization Stream Protocol](http://docs.oracle.com/javase/6/docs/platform/serialization/spec/protocol.html) (A protocal is not all, still need to refer to the implementation.)\n- [Object Serialization Stream Protocol Mind Node](https://www.dropbox.com/s/vfom3gz5t13h3w6/Object%20Serialization%20Stream%20Protocol.pdf)\n\n\n## Install\n\n```bash\n$ npm install java.io --save\n```\n\n## Usage\n\n### 1. readObject()\n\n```js\nvar fs = require('fs');\nvar io = require('java.io');\nvar InputObjectStream = io.InputObjectStream;\nvar OutputObjectStream = io.OutputObjectStream;\n\n// Read object and return whole info\nvar buf = fs.readFileSync('./test/fixtures/out/int/1024.bin');\nvar in = new InputObjectStream(buf, true);\nvar obj = in.readObject();\n\n// Read object but return value only\nvar buf2 = fs.readFileSync('./test/fixtures/out/int/1024.bin');\nvar in2 = new InputObjectStream(buf);\nvar obj2 = in.readObject();\n```\n\n`obj` should be:\n\n```js\n{\n  '$' : {\n    value : 1024\n  },\n  '$class' : {\n    name : 'java.lang.Integer',\n    serialVersionUID : '1360826667806852920',\n    flags : 2,\n    fields : [{\n      type : 'I',\n      name : 'value'\n    }],\n    superClass : {\n      name : 'java.lang.Number',\n      serialVersionUID : '-8742448824652078965',\n      flags : 2,\n      fields : [],\n      superClass : null\n    }\n  }\n}\n```\n\n`obj2` should be:\n\n```js\n1024\n```\n\nif you only care about the first object from input stream, you could write the code briefly:\n\n```js\nvar buf3 = fs.readFileSync('./test/fixtures/out/map/boolean.bin');\nvar obj3 = InputObjectStream.readObject(buf);\n```\n\nthen `obj3` should be:\n\n```js\n{ 'true': true, 'false': false }\n```\n\n### 2. writeObject(obj)\n\n```js\nvar outputObjectStream = new OutputObjectStream();\n\n// 1. Passed in argument must contains the whole info\n// 2. Every time calling the writeObject function\n//    will return the buf had written in\nvar buf = outputObjectStream.writeObject(obj);\n```\n\nA brief style is also OK:\n\n```js\nOutputObjectStream.writeObject(obj);\n```\n\n### 3. OutputObjectStream.normalize(obj, type)\n\nA convenient way to convert ordinary JavaScript object to object of standard format with whole info.\n\n- params\n  - obj: accept all primitive value or primitive array and map\n  - type: string | boolean | int | short | long | char | byte | float | double |\n- return: normalized object\n\n```js\nvar outputObjectStream = new OutputObjectStream();\nvar normalizedObj = OutputObjectStream.normalize(true);\nvar buf = outputObjectStream.writeObject(normalizedObj);\n```\n\n```js\nnormalize(null)\n\nnormalize('string')\n\nnormalize(true)\n\nnormalize(1) // quals to normalize(1, 'int')\n\nnormalize(-123456, long)\n\nnormalize([ true, false, false, false ], 'boolean')\n\nnormalize( {'true': true, 'false': false}, 'boolean')\n```\n\n### 4. addObject()\n\nIf a class has writeObject/readObject methods, you need to implement the corresponding methods, and add them via addObject() before read or write the object.\n\n```js\nvar io = require('java.io');\nio.addObject({{className}}, {{class}});\n\n```\n\nBuiltin classes:\n\n- [java.util.ArrayList](./lib/objects/array_list.js)\n- [java.util.LinkedList](./lib/objects/linked_list.js)\n- [java.util.HashMap](./lib/objects/hash_map.js)\n- [java.util.HashSet](./lib/objects/hash_set.js)\n- [java.util.TreeMap](./lib/objects/tree_map.js)\n- [java.util.TreeSet](./lib/objects/tree_set.js)\n- [java.util.Date](./lib/objects/date.js)\n\n## Data structure\n\n```js\n{\n  // if a object has it's own readObject/writeObject method\n  // save it's special value here\n  '_$': ...,\n\n  // value of object\n  '$': ...,\n\n  // class description\n  '$class': {\n    name: 'className',\n    serialVersionUID: 'SVUID',\n    flags: flags,\n    fields:\n     [ { type: 'F', name: 'primitiveProperty' },\n       { type: 'L', name: 'objProperty', classname: 'Ljava/lang/String;' }],\n    superClass: parentClassDescriptionOrNull\n  }\n}\n```\n\n[Some more examples](test/fixtures/in/)\n\n## Incompatible between 1.x and 2.x\n\n- decode java `[B` to `new Buffer([1, 2, 3])` not `[1, 2, 3]` [#10](https://github.com/node-modules/java.io/pull/10)\n\n## License\n\n[MIT](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fjava.io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fjava.io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fjava.io/lists"}