org.sitemesh.offline.directory
Interface Directory

All Known Implementing Classes:
FileSystemDirectory, InMemoryDirectory

public interface Directory

Abstraction over a directory of files. Allows SiteMeshOffline to be plugged into different sources/destinations.

Typically, you'd use FileSystemDirectory that reads/writes to disk.

Author:
Joe Walnes
See Also:
SiteMeshOffline, FileSystemDirectory

Method Summary
 void copy(String path, Directory destinationDirectory, String destinationPath)
          Copy a file from this directory to another location.
 List<String> listAllFilePaths()
          Get a list of all file paths (relative to the Directory).
 CharBuffer load(String path)
          Load the contents from a file.
 void load(String path, WritableByteChannel channelToWriteTo)
          Load binary data.
 void save(String path, CharBuffer contents)
          Save the contents to a file, overwriting any existing content.
 void save(String path, ReadableByteChannel channelToReadFrom, int length)
          Save binary data.
 

Method Detail

load

CharBuffer load(String path)
                throws IOException
Load the contents from a file.

Throws:
IOException

save

void save(String path,
          CharBuffer contents)
          throws IOException
Save the contents to a file, overwriting any existing content.

Throws:
IOException

listAllFilePaths

List<String> listAllFilePaths()
                              throws IOException
Get a list of all file paths (relative to the Directory). Excludes directories.

Throws:
IOException

load

void load(String path,
          WritableByteChannel channelToWriteTo)
          throws IOException
Load binary data.

Throws:
IOException

save

void save(String path,
          ReadableByteChannel channelToReadFrom,
          int length)
          throws IOException
Save binary data.

Throws:
IOException

copy

void copy(String path,
          Directory destinationDirectory,
          String destinationPath)
          throws IOException
Copy a file from this directory to another location. Will copy raw bytes so can deal with binary data (e.g. images).

Parameters:
path - Path of file to copy (from this Directory)
destinationDirectory - Target directory (may be this)
destinationPath - Path under target directory.
Throws:
IOException


Copyright © 2011. All Rights Reserved.