本文整理匯總了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());
}