Eliminate Resource.isMemoryMappable

This commit is contained in:
Joakim Erdfelt 2022-09-06 13:54:50 -05:00
parent 8953873e67
commit 9a553e1787
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
3 changed files with 4 additions and 18 deletions

View File

@ -1071,14 +1071,16 @@ public class BufferUtil
public static ByteBuffer toMappedBuffer(Resource resource) throws IOException
{
if (!resource.isMemoryMappable())
Path path = resource.getPath();
if (path == null)
return null;
return toMappedBuffer(resource.getPath());
}
public static ByteBuffer toMappedBuffer(Resource resource, long pos, long len) throws IOException
{
if (!resource.isMemoryMappable())
Path path = resource.getPath();
if (path == null)
return null;
return toMappedBuffer(resource.getPath(), pos, len);
}

View File

@ -279,12 +279,6 @@ public class PathResource extends Resource
return path.toAbsolutePath().toString();
}
@Override
public boolean isMemoryMappable()
{
return "file".equalsIgnoreCase(uri.getScheme());
}
@Override
public URI getURI()
{

View File

@ -252,16 +252,6 @@ public abstract class Resource
return Files.newByteChannel(getPath(), StandardOpenOption.READ);
}
/**
* Checks if the resource supports being loaded as a memory-mapped ByteBuffer.
*
* @return true if the resource supports memory-mapped ByteBuffer, false otherwise.
*/
public boolean isMemoryMappable()
{
return false;
}
/**
* list of resource names contained in the given resource.
* Ordering is unspecified, so callers may wish to sort the return value to ensure deterministic behavior.