How do I truncate a java integer to fit/exand to a given number of bytes?

I am designing an archive format(Just for fun) in Java using this template- First 4 bytes: Number of files in the archive Next 4 bytes: Number of bytes in the filename Next N bytes: Filename Next 10 bytes: Number of bytes in the file Next N bytes: File contents from https://stackoverflow.com/questions/5372764/php-safe-way-to-download-mutliple-files-and-save-them. I am having on trouble with finding the values of the number of files etc. but I don't know how to expand an integer into 4 bytes. Is it similar to this- https://stackoverflow.com/questions/119328/how-do-i-truncate-a-java-string-to-fit-in-a-given-number-of-bytes-once-utf-8-enc

以上就是How do I truncate a java integer to fit/exand to a given number of bytes?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏