Fix for java.lang.UnsupportedOperationException: newFileChannel

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2022-09-06 18:47:41 -05:00
parent a65a25e165
commit 8c7199c586
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 2 additions and 2 deletions

View File

@ -1072,7 +1072,7 @@ public class BufferUtil
public static ByteBuffer toMappedBuffer(Resource resource) throws IOException
{
Path path = resource.getPath();
if (path == null)
if (path == null || !path.toUri().getScheme().endsWith("file"))
return null;
return toMappedBuffer(path);
}
@ -1080,7 +1080,7 @@ public class BufferUtil
public static ByteBuffer toMappedBuffer(Resource resource, long pos, long len) throws IOException
{
Path path = resource.getPath();
if (path == null)
if (path == null || !path.toUri().getScheme().endsWith("file"))
return null;
return toMappedBuffer(path, pos, len);
}