Java Reference
In-Depth Information
L
ISTING
D.9
Continued
else
stringbuffer.append(s.charAt(j));
return stringbuffer.toString();
}
}
FileContentsImpl
This class (reported in Listing D.10) implements the
FileContents
JNLP runtime service
using a wrapped
File
instance.
L
ISTING
D.10
The
FileContentsImpl
Class
package com.marinilli.b2.ad.util;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.File;
import javax.jnlp.JNLPRandomAccessFile;
import javax.jnlp.FileContents;
/**
* Appendix D - a simple FileContents implementation
*
* @author Mauro Marinilli
* @version 1.0
*/
public class FileContentsImpl implements FileContents {
private File wrappedFile;
D
/**
* implementation constructor
*/
protected FileContentsImpl(File f) {
wrappedFile = f;
}
/**
* return whether the file can be read
*/
public boolean canRead() throws java.io.IOException {
return wrappedFile.canRead();
}