Top Description Fields Constructors Methods
org.codehaus.groovy.runtime

public Class WritableFile

extends File
implements Writable
Class Inheritance
All Implemented Interfaces
groovy.lang.Writable
Imports
groovy.lang.Writable, java.io.File, .IOException, .Reader, .Writer

A Writable File.

Field Summary

Modifier and TypeField and Description
private final String
private static final long
Inherited from java.io.File:
pathSeparatorpathSeparatorCharseparatorseparatorChar

Constructor Summary

AccessConstructor and Description
public
WritableFile(final File delegate)

public
WritableFile(final File delegate, final String encoding)

Method Summary

Modifier and TypeMethod and Description
public Writer
writeTo(final Writer
the Writer to which this Writable should output its data.
out
)

Implements groovy.lang.Writable.writeTo.

Writes this object to the given writer.
Inherited from java.io.File:
canExecutecanReadcanWritecompareTocreateNewFilecreateTempFilecreateTempFiledeletedeleteOnExitequalsexistsgetAbsoluteFilegetAbsolutePathgetCanonicalFilegetCanonicalPathgetFreeSpacegetNamegetParentgetParentFilegetPathgetTotalSpacegetUsableSpacehashCodeisAbsoluteisDirectoryisFileisHiddenlastModifiedlengthlistlistlistFileslistFileslistFileslistRootsmkdirmkdirsrenameTosetExecutablesetExecutablesetLastModifiedsetReadablesetReadablesetReadOnlysetWritablesetWritabletoPathtoStringtoURItoURL

Field Detail

encodingback to summary
private final String encoding
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.io.File.serialVersionUID.

Constructor Detail

WritableFileback to summary
public WritableFile(final File delegate)
WritableFileback to summary
public WritableFile(final File delegate, final String encoding)

Method Detail

writeToback to summary
public Writer writeTo(final Writer out) throws IOException

Implements groovy.lang.Writable.writeTo.

Doc from groovy.lang.Writable.writeTo.

Writes this object to the given writer.

This is used to defer content creation until the point when it is streamed to the output destination. Oftentimes, content will be defined but not necessarily created (as is may be the case with a Closure definition.) In that case, the output is then 'deferred' to the point when it is serialized to the writer. This class may be used whenever an object should be responsible for creating its own textual representation, but creating the entire output as a single String would be inefficient (such as outputting a multi-gigabyte XML document.)

Parameters
out:Writer

the Writer to which this Writable should output its data.

Returns:Writer

the Writer that was passed

Exceptions
IOException:
if an error occurred while outputting data to the writer