mirror of
https://github.com/Steffo99/unimore-oop-2020-cleaver.git
synced 2024-11-25 17:44:20 +00:00
Incomplete: use buffered reads and writes
This commit is contained in:
parent
fb94fd27ed
commit
606b1b3b2f
5 changed files with 18 additions and 22 deletions
|
@ -2,10 +2,10 @@
|
|||
<!-- NewPage -->
|
||||
<html lang="it">
|
||||
<head>
|
||||
<!-- Generated by javadoc (13.0.1) on Sun Jan 05 18:44:04 CET 2020 -->
|
||||
<!-- Generated by javadoc (13.0.1) on Thu Jan 09 00:14:43 CET 2020 -->
|
||||
<title>ChpFileError</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="dc.created" content="2020-01-05">
|
||||
<meta name="dc.created" content="2020-01-09">
|
||||
<meta name="description" content="declaration: module: eu.steffo.cleaver, package: eu.steffo.cleaver.errors, class: ChpFileError">
|
||||
<meta name="generator" content="javadoc/ClassWriterImpl">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<!-- NewPage -->
|
||||
<html lang="it">
|
||||
<head>
|
||||
<!-- Generated by javadoc (13.0.1) on Sun Jan 05 18:44:04 CET 2020 -->
|
||||
<!-- Generated by javadoc (13.0.1) on Thu Jan 09 00:14:43 CET 2020 -->
|
||||
<title>ProgrammingError</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="dc.created" content="2020-01-05">
|
||||
<meta name="dc.created" content="2020-01-09">
|
||||
<meta name="description" content="declaration: module: eu.steffo.cleaver, package: eu.steffo.cleaver.errors, class: ProgrammingError">
|
||||
<meta name="generator" content="javadoc/ClassWriterImpl">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
|
@ -129,7 +129,7 @@ extends <a href="https://docs.oracle.com/en/java/javase/13/docs/api/java.base/ja
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr class="altColor">
|
||||
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">ProgrammingError</a></span>()</code></th>
|
||||
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(java.lang.String)">ProgrammingError</a></span>​(<a href="https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> s)</code></th>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -168,8 +168,8 @@ extends <a href="https://docs.oracle.com/en/java/javase/13/docs/api/java.base/ja
|
|||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<section class="detail">
|
||||
<h3><a id="<init>()">ProgrammingError</a></h3>
|
||||
<div class="memberSignature"><span class="modifiers">public</span> <span class="memberName">ProgrammingError</span>()</div>
|
||||
<h3><a id="<init>(java.lang.String)">ProgrammingError</a></h3>
|
||||
<div class="memberSignature"><span class="modifiers">public</span> <span class="memberName">ProgrammingError</span>​(<span class="arguments"><a href="https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> s)</span></div>
|
||||
</section>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<!-- NewPage -->
|
||||
<html lang="it">
|
||||
<head>
|
||||
<!-- Generated by javadoc (13.0.1) on Sun Jan 05 18:44:04 CET 2020 -->
|
||||
<!-- Generated by javadoc (13.0.1) on Thu Jan 09 00:14:43 CET 2020 -->
|
||||
<title>eu.steffo.cleaver.errors</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="dc.created" content="2020-01-05">
|
||||
<meta name="dc.created" content="2020-01-09">
|
||||
<meta name="description" content="declaration: module: eu.steffo.cleaver, package: eu.steffo.cleaver.errors">
|
||||
<meta name="generator" content="javadoc/PackageWriterImpl">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
<!-- NewPage -->
|
||||
<html lang="it">
|
||||
<head>
|
||||
<!-- Generated by javadoc (13.0.1) on Sun Jan 05 18:44:04 CET 2020 -->
|
||||
<!-- Generated by javadoc (13.0.1) on Thu Jan 09 00:14:43 CET 2020 -->
|
||||
<title>eu.steffo.cleaver.errors Class Hierarchy</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="dc.created" content="2020-01-05">
|
||||
<meta name="dc.created" content="2020-01-09">
|
||||
<meta name="description" content="tree: module: eu.steffo.cleaver, package: eu.steffo.cleaver.errors">
|
||||
<meta name="generator" content="javadoc/PackageTreeWriter">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
|
|
|
@ -149,7 +149,7 @@ public class StitchJob extends Job {
|
|||
return doc;
|
||||
}
|
||||
|
||||
private static final int UPDATE_EVERY_BYTES = 16000;
|
||||
private static final int BUFFER_SIZE = 16384;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -161,18 +161,14 @@ public class StitchJob extends Job {
|
|||
InputStream inputStream = ICleaverInputStream.fromElement(cleaverNode, chpFolder, cryptKey);
|
||||
OutputStream outputStream = new FileOutputStream(resultFile);
|
||||
|
||||
//Pipe everything to the output
|
||||
int bytesUntilNextUpdate = UPDATE_EVERY_BYTES;
|
||||
//Pipe everything to the output, in chunks
|
||||
this.setProgress(new WorkingProgress());
|
||||
|
||||
int i;
|
||||
while((i = inputStream.read()) != -1) {
|
||||
outputStream.write(i);
|
||||
bytesUntilNextUpdate -= 1;
|
||||
if(bytesUntilNextUpdate <= 0) {
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
//Loop until the first byte in the buffer is -1
|
||||
while(inputStream.read(buffer) != -1) {
|
||||
outputStream.write(buffer);
|
||||
this.setProgress(new WorkingProgress((float)(resultFile.length() - inputStream.available()) / (float)resultFile.length()));
|
||||
bytesUntilNextUpdate = UPDATE_EVERY_BYTES;
|
||||
}
|
||||
}
|
||||
|
||||
inputStream.close();
|
||||
|
|
Loading…
Reference in a new issue