package com.hughes.android.dictionary.engine;
-import java.io.OutputStream;
import java.io.IOException;
+import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
try {
pipe = new PipedInputStream(this, size);
buffer = new byte[BLOCK_SIZE];
- writeThread = new Thread(new Runnable() {
- public void run() {
- int read;
- try {
- while ((read = pipe.read(buffer)) > 0)
- {
- out.write(buffer, 0, read);
- out.flush();
- }
- } catch (IOException e) {
- System.out.println("Error writing to file " + e);
+ writeThread = new Thread(() -> {
+ int read;
+ try {
+ while ((read = pipe.read(buffer)) > 0)
+ {
+ out.write(buffer, 0, read);
+ out.flush();
}
- try {
- out.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ System.out.println("Error writing to file " + e);
}
+ try {
+ out.close();
+ } catch (IOException e) {}
});
writeThread.start();
} catch (IOException e) {}
Thread writeThread;
OutputStream out;
PipedInputStream pipe;
- byte buffer[];
+ byte[] buffer;
}