Java 类java.util.zip.ZipError 实例源码

项目:OpenJSharp    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:OpenJSharp    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:jdk8u-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:jdk8u-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:jdk8u_jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:jdk8u_jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:infobip-open-jdk-8    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:infobip-open-jdk-8    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:jdk8u-dev-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:jdk8u-dev-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:jdk7-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:jdk7-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:openjdk-source-code-learn    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:openjdk-source-code-learn    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:OLD-OpenJDK8    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:OLD-OpenJDK8    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:openjdk-jdk7u-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:openjdk-jdk7u-jdk    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:openjdk-icedtea7    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(URI uri, Map<String, ?> env)
    throws IOException
{
    Path path = uriToPath(uri);
    synchronized(filesystems) {
        Path realPath = null;
        if (ensureFile(path)) {
            realPath = path.toRealPath();
            if (filesystems.containsKey(realPath))
                throw new FileSystemAlreadyExistsException();
        }
        ZipFileSystem zipfs = null;
        try {
            zipfs = new ZipFileSystem(this, path, env);
        } catch (ZipError ze) {
            String pname = path.toString();
            if (pname.endsWith(".zip") || pname.endsWith(".jar"))
                throw ze;
            // assume NOT a zip/jar file
            throw new UnsupportedOperationException();
        }
        filesystems.put(realPath, zipfs);
        return zipfs;
    }
}
项目:openjdk-icedtea7    文件:ZipFileSystemProvider.java   
@Override
public FileSystem newFileSystem(Path path, Map<String, ?> env)
    throws IOException
{
    if (path.getFileSystem() != FileSystems.getDefault()) {
        throw new UnsupportedOperationException();
    }
    ensureFile(path);
    try {
        return new ZipFileSystem(this, path, env);
    } catch (ZipError ze) {
        String pname = path.toString();
        if (pname.endsWith(".zip") || pname.endsWith(".jar"))
            throw ze;
        throw new UnsupportedOperationException();
    }
}
项目:buck    文件:Unzip.java   
/**
 * Gets a set of files that are contained in an archive
 *
 * @param archiveAbsolutePath The absolute path to the archive
 * @return A set of files (not directories) that are contained in the zip file
 * @throws IOException If there is an error reading the archive
 */
public static ImmutableSet<Path> getZipMembers(Path archiveAbsolutePath) throws IOException {
  try (FileSystem zipFs = FileSystems.newFileSystem(archiveAbsolutePath, null)) {
    Path root = Iterables.getOnlyElement(zipFs.getRootDirectories());
    return Files.walk(root)
        .filter(path -> !Files.isDirectory(path))
        .map(root::relativize)
        .map(path -> Paths.get(path.toString())) // Clear the filesystem from the path
        .collect(ImmutableSet.toImmutableSet());
  } catch (ZipError error) {
    // For some reason the zip filesystem support throws an error when an IOException would do
    // just as well.
    throw new IOException(
        String.format("Could not read %s because of %s", archiveAbsolutePath, error.toString()),
        error);
  }
}
项目:OpenJSharp    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:jdk8u-jdk    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:jdk8u_jdk    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:lookaside_java-1.8.0-openjdk    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:AndroidStudyDemo    文件:PseudoEncryptionUtil.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:incubator-taverna-language    文件:BundleFileTypeDetector.java   
@Override
public String probeContentType(Path path) throws IOException {

    ByteBuffer buf = ByteBuffer.allocate(256);
    try (SeekableByteChannel byteChannel = Files.newByteChannel(path,
            StandardOpenOption.READ)) {
        int read = byteChannel.read(buf);
        if (read < 38) {
            return null;
        }
        ;
    }
    buf.flip();

    // Look for PK

    byte[] firstBytes = buf.array();
    String pk = new String(firstBytes, 0, 2, LATIN1);
    if (!(pk.equals("PK") && firstBytes[2] == 3 && firstBytes[3] == 4)) {
        // Did not match magic numbers of ZIP as specified in ePub OCF
        // http://www.idpf.org/epub/30/spec/epub30-ocf.html#app-media-type
        return null;
    }

    String mimetype = new String(firstBytes, 30, 8, LATIN1);
    if (!mimetype.equals(MIMETYPE)) {
        return APPLICATION_ZIP;
    }
    // Read the 'mimetype' file.
    try (ZipInputStream is = new ZipInputStream(new ByteArrayInputStream(
            firstBytes))) {
        ZipEntry entry = is.getNextEntry();
        if (!MIMETYPE.equals(entry.getName())) {
            return APPLICATION_ZIP;
        }
        byte[] mediaTypeBuffer = new byte[256];
        int size = is.read(mediaTypeBuffer);
        if (size < 1) {
            return APPLICATION_ZIP;
        }
        return new String(mediaTypeBuffer, 0, size, ASCII);
    } catch (ZipException | ZipError e) {
        return null;
    }
}
项目:infobip-open-jdk-8    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:jdk8u-dev-jdk    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:datakernel    文件:FatalErrorHandlers.java   
public static FatalErrorHandler exitOnJvmError() {
    return exitOnMatchedError(singletonList(Error.class), asList(AssertionError.class, StackOverflowError.class, IOError.class, ZipError.class));
}
项目:jdk7-jdk    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:openjdk-source-code-learn    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:OLD-OpenJDK8    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:cn1    文件:ZipErrorTest.java   
/**
 * @tests {@link java.util.zip.ZipError#ZipError(String)}
 */
public void test_constructor() {
    ZipError error = new ZipError("ZipError");
    assertEquals("ZipError", error.getMessage());
}
项目:cn1    文件:ZipErrorTest.java   
/**
 * @tests java.util.zip.ZipError#Serialization()
 */
public void test_serialization() throws Exception {
    ZipError error = new ZipError("serialization test");
    SerializationTest.verifySelf(error);
}
项目:cn1    文件:ZipErrorTest.java   
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {
    ZipError error = new ZipError("serialization test");
    SerializationTest.verifyGolden(this, error);
}
项目:openjdk-jdk7u-jdk    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}
项目:openjdk-icedtea7    文件:ZipFileSystem.java   
static void zerror(String msg) {
    throw new ZipError(msg);
}