spring-geode/src/main/java/org/springframework/geode/core/io/support/ResourceUtils.java
/**
	 * Returns the {@link Resource} as a {@link WritableResource} if possible.
	 *
	 * This method makes a best effort to determine whether the target {@link Resource} is actually {@literal writable}.
	 * Even still, it may be possible that a write to the target {@link Resource} will fail.
	 *
	 * The {@link Resource} is {@literal writable} if the {@link Resource} is an instance of {@link WritableResource}
	 * and {@link WritableResource#isWritable()} returns {@literal true}.
	 *
	 * @param resource {@link Resource} to cast to a {@link WritableResource}.
	 * @return a {@link WritableResource} from the target {@link Resource} if possible; never {@literal null}.
	 * @throws IllegalStateException if the target {@link Resource} is not {@literal writable}.
	 * @see org.springframework.core.io.WritableResource
	 * @see org.springframework.core.io.Resource
	 */
Returns the  Resource as a  WritableResource if possible.
This method makes a best effort to determine whether the target  Resource is actually  writable.
Even still, it may be possible that a write to the target  Resource will fail.

The  Resource is  writable if the  Resource is an instance of  WritableResource
and  WritableResource#isWritable() returns  true.

@param resource  Resource to cast to a  WritableResource.
@return a  WritableResource from the target  Resource if possible; never  null.
@throws IllegalStateException if the target  Resource is not  writable.
Returns the Resource as a WritableResource if possible . This method makes a best effort to determine whether the target Resource is actually writable . Even still it may be possible that a write to the target Resource will fail . The Resource is writable if the Resource is an instance of WritableResource and WritableResource#isWritable () returns true . @param resource Resource to cast to a WritableResource . @return a WritableResource from the target Resource if possible ; never null . @throws IllegalStateException if the target Resource is not writable .
public static @NonNull WritableResource asStrictlyWritableResource(@Nullable Resource resource) {
		return Optional.ofNullable(resource)
			.filter(WritableResource.class::isInstance)
			.map(WritableResource.class::cast)
			.filter(WritableResource::isWritable)
			.orElseThrow(() -> newIllegalStateException("Resource [%s] is not writable",
				ResourceUtils.nullSafeGetDescription(resource)));
	}
public static @ NonNull WritableResource asStrictlyWritableResource ( @ Nullable Resource resource ) { return Optional . ofNullable ( resource ) . filter ( WritableResource . class :: isInstance ) . map ( WritableResource . class :: cast ) . filter ( WritableResource :: isWritable ) . orElseThrow ( ( ) -> newIllegalStateException ( "Resource [%s] is not writable" , ResourceUtils . nullSafeGetDescription ( resource ) ) ) ; }
Returns the {@link Resource} as a {@link WritableResource} if possible.
Returns the { @link Resource } as a { @link WritableResource } if possible .