Eliminate Resource.isMemoryMappable
This commit is contained in:
parent
8953873e67
commit
9a553e1787
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue