gpt4 book ai didi

loci.common.ZipHandle类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 07:19:31 28 4
gpt4 key购买 nike

本文整理了Java中loci.common.ZipHandle类的一些代码示例,展示了ZipHandle类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipHandle类的具体详情如下:
包路径:loci.common.ZipHandle
类名称:ZipHandle

ZipHandle介绍

[英]StreamHandle implementation for reading from Zip-compressed files or byte arrays. Instances of ZipHandle are read-only.
[中]

代码示例

代码示例来源:origin: ome/formats-common

private static RandomAccessInputStream openStream(String file)
 throws IOException
{
 return new RandomAccessInputStream(getHandle(file), file);
}

代码示例来源:origin: ome/formats-common

/**
 * Constructs a new ZipHandle corresponding to the given entry of the
 * specified Zip file.
 *
 * @throws HandleException if the given file is not a Zip file.
 */
public ZipHandle(String file, ZipEntry entry) throws IOException {
 super();
 this.file = file;
 in = openStream(file);
 zip = new ZipInputStream(in);
 entryName = entry.getName();
 entryCount = 1;
 seekToEntry();
 resetStream();
 length = entry.getSize();
 if (length <= 0) {
  populateLength();
 }
}

代码示例来源:origin: ome/formats-common

@Override
protected void resetStream() throws IOException {
 if (stream != null) stream.close();
 if (in != null) {
  in.close();
  in = openStream(file);
 }
 if (zip != null) zip.close();
 zip = new ZipInputStream(in);
 if (entryName != null) seekToEntry();
 stream = new DataInputStream(new BufferedInputStream(
  zip, RandomAccessInputStream.MAX_OVERHEAD));
 stream.mark(RandomAccessInputStream.MAX_OVERHEAD);
}

代码示例来源:origin: org.openmicroscopy/ome-common

this.file = file;
in = openStream(file);
zip = new ZipInputStream(in);
entryName = null;
 length += ze.getSize();
resetStream();
 populateLength();

代码示例来源:origin: ome/formats-common

handle = new URLHandle(mapId);
else if (allowArchiveHandles && ZipHandle.isZipFile(mapId)) {
 handle = new ZipHandle(mapId);

代码示例来源:origin: ome/formats-bsd

ZipHandle handle = new ZipHandle(id, ze);
Location.mapFile(ze.getName(), handle);
mappedFiles.add(ze.getName());

代码示例来源:origin: ome/formats-common

private void populateLength() throws IOException {
 length = -1;
 while (stream.available() > 0) {
  stream.skip(1);
  length++;
 }
 resetStream();
}

代码示例来源:origin: ome/formats-common

this.file = file;
in = openStream(file);
zip = new ZipInputStream(in);
entryName = null;
 length += ze.getSize();
resetStream();
 populateLength();

代码示例来源:origin: org.openmicroscopy/ome-common

handle = new URLHandle(mapId);
else if (allowArchiveHandles && ZipHandle.isZipFile(mapId)) {
 handle = new ZipHandle(mapId);

代码示例来源:origin: org.openmicroscopy/ome-common

@Override
protected void resetStream() throws IOException {
 if (stream != null) stream.close();
 if (in != null) {
  in.close();
  in = openStream(file);
 }
 if (zip != null) zip.close();
 zip = new ZipInputStream(in);
 if (entryName != null) seekToEntry();
 stream = new DataInputStream(new BufferedInputStream(
  zip, RandomAccessInputStream.MAX_OVERHEAD));
 stream.mark(RandomAccessInputStream.MAX_OVERHEAD);
}

代码示例来源:origin: openmicroscopy/bioformats

ZipHandle handle = new ZipHandle(id, ze);
Location.mapFile(ze.getName(), handle);
mappedFiles.add(ze.getName());

代码示例来源:origin: org.openmicroscopy/ome-common

private void populateLength() throws IOException {
 length = -1;
 while (stream.available() > 0) {
  stream.skip(1);
  length++;
 }
 resetStream();
}

代码示例来源:origin: org.openmicroscopy/ome-common

/**
 * Constructs a new ZipHandle corresponding to the given entry of the
 * specified Zip file.
 *
 * @param file a name that can be passed to
 *        {@link Location#getHandle(String, boolean, boolean)}
 * @param entry the specific entry in the Zip file to be opened
 * @throws HandleException if the given file is not a Zip file.
 * @see ZipEntry
 */
public ZipHandle(String file, ZipEntry entry) throws IOException {
 super();
 this.file = file;
 in = openStream(file);
 zip = new ZipInputStream(in);
 entryName = entry.getName();
 entryCount = 1;
 seekToEntry();
 resetStream();
 length = entry.getSize();
 if (length <= 0) {
  populateLength();
 }
}

代码示例来源:origin: org.openmicroscopy/ome-common

private static RandomAccessInputStream openStream(String file)
 throws IOException
{
 return new RandomAccessInputStream(getHandle(file), file);
}

代码示例来源:origin: ome/formats-common

/** Returns true if the given filename is a Zip file. */
public static boolean isZipFile(String file) throws IOException {
 if (!file.toLowerCase().endsWith(".zip")) return false;
 IRandomAccess handle = getHandle(file);
 byte[] b = new byte[2];
 if (handle.length() >= 2) {
  handle.read(b);
 }
 handle.close();
 return new String(b, Constants.ENCODING).equals("PK");
}

代码示例来源:origin: org.openmicroscopy/ome-common

/**
 * @param file a name that can be passed to
 *        {@link Location#getHandle(String, boolean, boolean)}
 * @return true if the given filename is a Zip file.
 * @throws IOException if the file cannot be read
 */
public static boolean isZipFile(String file) throws IOException {
 if (!file.toLowerCase().endsWith(".zip")) return false;
 IRandomAccess handle = getHandle(file);
 byte[] b = new byte[2];
 if (handle.length() >= 2) {
  handle.read(b);
 }
 handle.close();
 return new String(b, Constants.ENCODING).equals("PK");
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com