澄清Object类中的finalize()方法(Clarification on finalize() method in Object class)
如果有人能够在Object类的finalize()方法的javadoc中正确地澄清2点,那将会很有帮助:
1. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked.
“用户可见”同步的意义是什么? 除了“用户可见”之外还有其他同步吗?
2. The finalize method is never invoked more than once by a Java virtual machine for any given object.
在这种情况下,JVM必须保持所创建的每个对象的唯一标识与已调用其finalize方法的信息。 难道它最终会超越它存储的任何区域吗?
It'd be helpful if anyone could clarify properly on the 2 points from javadoc of finalize() method in Object class:
1. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked.
What is the significance of 'user-visible' synchronization? Are there any other synchcronization apart from 'user-visible'?
2. The finalize method is never invoked more than once by a Java virtual machine for any given object.
In that case, JVM must maintain unique identity of each and every object ever created vs the information that its finalize method has been invoked. Wouldn't it ultimately grow beyond whatever region it is stored in ?
原文:https://stackoverflow.com/questions/23359753
最满意答案
您可以使用perl的Archive :: ZIP或Python的zipfile来提取存档中文件的文件名,大小和CRC校验和。 创建一个文件,其中包含按文件名排序的结果(忽略路径)。
对于较小的ZIP,请合并脚本的结果(
cat list1 list2 list3 | sort
)。现在,您可以使用
diff
来比较结果。You can use perl's Archive::ZIP or Python's zipfile to extract the filenames, sizes and CRC checksums of the files in the archives. Create a file which contains the results sorted by file name (ignore the path).
For your smaller ZIPs, merge the results of the script (
cat list1 list2 list3 | sort
).Now, you can use
diff
to compare the results.
相关问答
更多-
如果您正在操纵ZIP文件,您可能需要查看第三方库来帮助您。 例如,最近更新的DotNetZip。 现在版本是v1.8。 以下是创建zip的示例: using (ZipFile zip = new ZipFile()) { zip.AddFile("c:\\photos\\personal\\7440-N49th.png"); zip.AddFile("c:\\Desktop\\2005_Annual_Report.pdf"); zip.AddFile("ReadMe.txt"); zip. ...
-
扩展链接问题中给出的示例,您可以按如下方式执行: import tarfile import StringIO import time tar = tarfile.TarFile("test.tar", "w") string = StringIO.StringIO() string.write("hello") string.seek(0) info = tarfile.TarInfo(name='dir') info.type = tarfile.DIRTYPE info.mode = 0755 ...
-
找到解决我自己的问题。 安装UnRar http://www.win-rar.com/rarextras.html (我正在使用CentOS: yum install unrar )
如何创建self-extracted_archive(以编程方式)(how to create self-extracting_archive ( programmatically ))[2024-03-25]
您可以使用7-zip为Windows创建自解压存档,如果要以编程方式创建它们,则可以使用SDK 。 You can create self-extracting archives for windows with 7-zip, if you want to create them programmatically you can use the SDK.为什么不使用stat来比较两个文件? 只是一个简单的例子: - name: Get cksum of my First file stat: path : "/poc/files/{{ inventory_hostname }}.result" register: myfirstfile - name: Current SHA1 set_fact: mf1sha1: "{{ myfirstfile.stat.checksum }}" - name: Get cksum of ...如果我正确读取了伪代码,如果它们与您当前的待存档WAL不相同,您将覆盖存档中的WAL段。 问题在于,WAL档案是非常重要的信息,你正在为以前有人写过的存档的WAL段写字。 如果错误配置两个PostgreSQL集群错误地写入同一个归档目录,则WAL归档将被破坏。 在这种情况下停止归档并提醒管理员会更好。 If I read your pseudo-code correctly, you'll overwrite WAL segments in the archive if they are not ident ...你可以对每个文件做一个校验和并比较一下...... $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider $hash = [System.BitConverter]::ToString($md5.ComputeHash([System.IO.File]::ReadAllBytes($file))) You could do a checksum of each file and compare t ...如何以编程方式比较两个存档文件的内容?(How do you compare the content of two archive files programmatically?)[2023-06-12]
您可以使用perl的Archive :: ZIP或Python的zipfile来提取存档中文件的文件名,大小和CRC校验和。 创建一个文件,其中包含按文件名排序的结果(忽略路径)。 对于较小的ZIP,请合并脚本的结果( cat list1 list2 list3 | sort )。 现在,您可以使用diff来比较结果。 You can use perl's Archive::ZIP or Python's zipfile to extract the filenames, sizes and CRC che ...以下命令准备由指定的提交修改的所有文件的存档: $ git diff-tree -z --no-commit-id --name-only -r| xargs -0 git archive -o list.zip HEAD: The following command prepares an archive of all the files modified by the commit specified : $ git diff-tree -z --no-commit-id - ... 这有帮助吗? for f in *.tar do echo "content of $f:" tar tvf "$f" done does this help? for f in *.tar do echo "content of $f:" tar tvf "$f" done相关文章
更多- Object Oriented Programming
- Guava学习笔记:复写的Object常用方法
- Cannot expose request attribute 'website' because of an existing model object of the same name 的解决方案
- 研磨设计模式之工厂方法模式(Factory Method)-模式讲解3
- 研磨设计模式之工厂方法模式(Factory Method)-模式讲解1
- 研磨设计模式之工厂方法模式(Factory Method)-模式讲解2
- 研磨设计模式之工厂方法模式(Factory Method)-解决方案
- 如何卸载assembly?或者class
- 关于Thread类中的start()方法和run()方法
- java反射详解(一)_Class类
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。