spring-geode/src/main/java/org/springframework/geode/core/io/support/FileResourceWriter.java
/**
	 * Tries to construct a new {@link File} based {@link OutputStream} from the {@literal target} {@link Resource}.
	 *
	 * By default, the constructed {@link OutputStream} is also buffered (e.g. {@link BufferedOutputStream}).
	 *
	 * @return a {@link OutputStream} writing to a {@link File} identified by the {@literal target} {@link Resource}.
	 * @throws IllegalStateException if the {@literal target} {@link Resource} cannot be handled as a {@link File}.
	 * @throws DataAccessResourceFailureException if the {@link OutputStream} could not be created.
	 * @see java.io.BufferedOutputStream
	 * @see java.io.OutputStream
	 * @see #getBufferSize()
	 * @see #getOpenOptions()
	 * @see #getResource()
	 */
Tries to construct a new  File based  OutputStream from the  target  Resource.
By default, the constructed  OutputStream is also buffered .

@return a  OutputStream writing to a  File identified by the  target  Resource.
@throws IllegalStateException if the  target  Resource cannot be handled as a  File.
@throws DataAccessResourceFailureException if the  OutputStream could not be created.
Tries to construct a new File based OutputStream from the target Resource . By default the constructed OutputStream is also buffered . @return a OutputStream writing to a File identified by the target Resource . @throws IllegalStateException if the target Resource cannot be handled as a File . @throws DataAccessResourceFailureException if the OutputStream could not be created .
protected OutputStream newFileOutputStream() {
		return getResource()
			.filter(this::isAbleToHandle)
			.map(resource -> {
				try {
					OutputStream fileOutputStream =
						Files.newOutputStream(resource.getFile().toPath(), getOpenOptions());
					return new BufferedOutputStream(fileOutputStream, getBufferSize());
				}
				catch (IOException cause) {
					String message = String.format("Failed to access the Resource [%s] as a file",
						resource.getDescription());
					throw new ResourceDataAccessException(message, cause);
				}
			})
			.orElseThrow(() -> newIllegalStateException("Resource [%s] is not a file based resource",
				getResource().map(Resource::getDescription).orElse(null)));
	}
protected OutputStream newFileOutputStream ( ) { return getResource ( ) . filter ( this :: isAbleToHandle ) . map ( resource -> { try { OutputStream fileOutputStream = Files . newOutputStream ( resource . getFile ( ) . toPath ( ) , getOpenOptions ( ) ) ; return new BufferedOutputStream ( fileOutputStream , getBufferSize ( ) ) ; } catch ( IOException cause ) { String message = String . format ( "Failed to access the Resource [%s] as a file" , resource . getDescription ( ) ) ; throw new ResourceDataAccessException ( message , cause ) ; } } ) . orElseThrow ( ( ) -> newIllegalStateException ( "Resource [%s] is not a file based resource" , getResource ( ) . map ( Resource :: getDescription ) . orElse ( null ) ) ) ; }
Tries to construct a new {@link File} based {@link OutputStream} from the {@literal target} {@link Resource}.
Tries to construct a new { @link File } based { @link OutputStream } from the { @literal target } { @link Resource } .