< prev index next >

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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
+ * 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,11 +254,13 @@
             String scheme = uri.getScheme().toLowerCase();
             return ("http".equals(scheme) || "https".equals(scheme));
         }
 
         boolean isSeekable() {
-            return (urlConnection instanceof HttpURLConnection) || (urlConnection instanceof JarURLConnection);
+            return (urlConnection instanceof HttpURLConnection) ||
+                   (urlConnection instanceof JarURLConnection) ||
+                   isJRT();
         }
 
         boolean isRandomAccess() {
             return false;
         }

@@ -295,11 +297,11 @@
                 } finally {
                     if (tmpURLConnection != null) {
                         Locator.closeConnection(tmpURLConnection);
                     }
                 }
-            } else if (urlConnection instanceof JarURLConnection) {
+            } else if ((urlConnection instanceof JarURLConnection) || isJRT()) {
                 try {
                     closeConnection();
 
                     urlConnection = uri.toURL().openConnection();
 

@@ -333,10 +335,15 @@
         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 >