Returns the size of the buffer to create.
Returns the size of the buffer to create. If the dataSize is non-null it can be used in determining the best size to use.
The default algorithm will create a buffer that is dataSize if dataSize <= recommendedByteBufferSize and the buffer is read-only. Otherwise recommendedByteBufferSize is used
optionally provide the size of the input. usually only matters when reading
indicates if the buffer will be used in read only operations
Returns the size of the character buffer to create.
Returns the size of the character buffer to create. If the dataSize is non-null it can be used in determining the best size to use.
The default algorithm will create a buffer that is dataSize if dataSize <= recommendedCharBufferSize and the buffer is read-only. Otherwise recommendedCharBufferSize is used
optionally provide the size of the input. usually only matters when reading
indicates if the buffer will be used in read only operations
Mutate the current instance by modifying the behavior of some of the functions.
Mutate the current instance by modifying the behavior of some of the functions.
A typical use is as follows:
context.copy(newErrorHandler = Some( myErrorHandler ) )
This example will return a new copy of the context with a new error handler configured. All other methods will behave the same as the original context.
A new strategy for determining the size of a byte buffer to make. The default value is None which will keep the behaviour of the current context
A new strategy for determining the size of a character buffer to make The default value is None which will keep the behaviour of the current context
A new strategy for creating an nio ByteBuffer The default value is None which will keep the behaviour of the current context
A new strategy for handling errors encountered by the associated resource The default value is None which will keep the behaviour of the current context
A new descriptive name for the associated resources The default value is None which will keep the behaviour of the current context
Creates the byte buffer.
Creates the byte buffer.
Implementation is simply:
createNioBuffer(byteBufferSize(dataSize, readOnly), channel, readOnly)
size of the buffer to make. The buffer will always be this size, unless the file is memory-mapped and the channel is smaller than bufferSize. In which case it will be the size of the channel.
Optionally the channel that this buffer will be used with. See section above about memory mapping. The channel can be used by subclasses to determine the type of buffer to return
if the use of the buffer will be read-only on the channel provided
Creates a buffer for channels.
Creates a buffer for channels. This is java specific API and is not cross platform. Subclasses override this method in order to enable memory mapping of files.
The default implementation will create a direct ByteBuffer unless
If all these criteria are met then the file will be memory-mapped.
size of the buffer to make. The buffer will always be this size, unless the file is memory-mapped and the channel is smaller than bufferSize. In which case it will be the size of the channel.
Optionally the channel that this buffer will be used with. See section above about memory mapping. The channel can be used by subclasses to determine the type of buffer to return
if the use of the buffer will be readonly on the channel provided
A name that describes the resource.
A name that describes the resource. This has no real functional value, it is intended to assist in debugging (for example loggin)
Called when an exception is raised during an IO operation.
Called when an exception is raised during an IO operation. The resource will be closed and all exceptions (including the closing exceptions) will be passed to this errorHandler.
If no exception occurred during the access of the resource the mainException will be a Right(...) containing the result and the closingExceptions will contain the list of exceptions raised while closing the resource (and the CloseActions)
The default behaviour is to throw a ScalaIOException irregardless of whether the exception occurred during the operation or during closing the resource.
the exception that occurred during the resource access or the result.
the exceptions raised while closing the resource.
the value of accessResult if it has a result. If a value cannot be returned an exception should be thrown. DO NOT RETURN null!
The error handling is very experimental and could be removed or dramatically altered. Please give feedback. An error handling API less likely to change is the Processor API error handling.
Called when opening the resource and an exception occurs.
Called when opening the resource and an exception occurs.
The default behaviour is to throw the openException
the exception that was raised while opening the resource.
if a default value can be determined by inspecting f or openException then this method can return that value. The value will be returned in lieu of the result calling f. If a value cannot be returned an exception should be thrown. DO NOT RETURN null!
The error handling is very experimental and could be removed or dramatically altered. Please give feedback. An error handling API less likely to change is the Processor API error handling.
The recommended size of a byte buffer for the current platform
The recommended size of a byte buffer for the current platform
The recommended size of a character buffer for the current platform
The recommended size of a character buffer for the current platform
The default ResourceContext