本文整理汇总了Java中java.util.zip.ZipFile.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ZipFile.getName方法的具体用法?Java ZipFile.getName怎么用?Java ZipFile.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.zip.ZipFile
的用法示例。
在下文中一共展示了ZipFile.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScriptPackage
import java.util.zip.ZipFile; //导入方法依赖的package包/类
public ScriptPackage(ZipFile pack)
{
_scriptFiles = new ArrayList<>();
_otherFiles = new ArrayList<>();
_name = pack.getName();
addFiles(pack);
}
示例2: ArchiveWriter
import java.util.zip.ZipFile; //导入方法依赖的package包/类
@Deprecated
public ArchiveWriter(ZipFile archive) {
archiveName = archive.getName();
try {
this.archive = new ZipArchive(archiveName);
}
catch (IOException e) {
archive = null;
WriteErrorDialog.error(e, archiveName);
}
}
示例3: inZip
import java.util.zip.ZipFile; //导入方法依赖的package包/类
@Override
public DetectedString inZip(ZipFile zipFile, String pathInZip) {
Objects.requireNonNull(pathInZip, "path in zip must be not null");
Objects.requireNonNull(zipFile, "zip file must be not null");
this.zip = pathInZip;
return new DetectedString(url, zip, line, zipFile.getName());
}
示例4: extract
import java.util.zip.ZipFile; //导入方法依赖的package包/类
private static URI extract(final ZipFile zipFile,
final String fileName)
throws IOException
{
final File tempFile;
final ZipEntry entry;
final InputStream zipStream;
OutputStream fileStream;
tempFile = File.createTempFile(fileName, Long.toString(System.currentTimeMillis()));
tempFile.deleteOnExit();
entry = zipFile.getEntry(fileName);
if(entry == null)
{
throw new FileNotFoundException("cannot find file: " + fileName + " in archive: " + zipFile.getName());
}
zipStream = zipFile.getInputStream(entry);
fileStream = null;
try
{
final byte[] buf;
int i;
fileStream = new FileOutputStream(tempFile);
buf = new byte[1024];
i = 0;
while((i = zipStream.read(buf)) != -1)
{
fileStream.write(buf, 0, i);
}
}
finally
{
close(zipStream);
close(fileStream);
}
return (tempFile.toURI());
}