< prev index next >

modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/ConnectionHolder.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 254,264 **** String scheme = uri.getScheme().toLowerCase(); return ("http".equals(scheme) || "https".equals(scheme)); } boolean isSeekable() { ! return (urlConnection instanceof HttpURLConnection) || (urlConnection instanceof JarURLConnection); } boolean isRandomAccess() { return false; } --- 254,266 ---- String scheme = uri.getScheme().toLowerCase(); return ("http".equals(scheme) || "https".equals(scheme)); } boolean isSeekable() { ! return (urlConnection instanceof HttpURLConnection) || ! (urlConnection instanceof JarURLConnection) || ! isJRT(); } boolean isRandomAccess() { return false; }
*** 295,305 **** } finally { if (tmpURLConnection != null) { Locator.closeConnection(tmpURLConnection); } } ! } else if (urlConnection instanceof JarURLConnection) { try { closeConnection(); urlConnection = uri.toURL().openConnection(); --- 297,307 ---- } finally { if (tmpURLConnection != null) { Locator.closeConnection(tmpURLConnection); } } ! } else if ((urlConnection instanceof JarURLConnection) || isJRT()) { try { closeConnection(); urlConnection = uri.toURL().openConnection();
*** 333,342 **** --- 335,349 ---- private ReadableByteChannel openChannel(InputStream inputStream) throws IOException { return (inputStream == null) ? Channels.newChannel(urlConnection.getInputStream()) : Channels.newChannel(inputStream); } + + private boolean isJRT() { + String scheme = uri.getScheme().toLowerCase(); + return "jrt".equals(scheme); + } } // A "ConnectionHolder" that "reads" from a ByteBuffer, generally loaded from // some unsupported or buggy source private static class MemoryConnectionHolder extends ConnectionHolder {
< prev index next >