Package net.sf.basedb.core
Class File.CharsetTesterThread
java.lang.Object
net.sf.basedb.core.File.CharsetTesterThread
- All Implemented Interfaces:
Runnable
- Enclosing class:
- File
-
Field Summary
Modifier and TypeFieldDescriptionprivate boolean
private final CharsetDetector
private boolean
private final PipedInputStream
private final PipedOutputStream
private Thread
-
Constructor Summary
-
Method Summary
-
Field Details
-
pop
-
pip
-
detector
-
thread
-
couldParse
private volatile boolean couldParse -
isRunning
private volatile boolean isRunning
-
-
Constructor Details
-
CharsetTesterThread
CharsetTesterThread(Charset charset) throws IOException - Throws:
IOException
-
-
Method Details
-
run
public void run()Runs in a separate thread. -
getCharset
-
couldParse
public boolean couldParse()Returns TRUE if the file seems like valid (UTF-8). Note that this may not be correct until the close() method has been called. -
write
public void write(byte[] b, int off, int len) Runs in the main thread. Copy bytes to charset detector via the piped streams. -
write
public void write(int b) Runs in the main thread. Copy bytes to charset detector via the piped streams. -
close
public void close()The file has been uploaded. Wait for the charset detector threas to finish and the close everything.
-