work in progress
This commit is contained in:
parent
bc1dc403b2
commit
d2613d3620
2 changed files with 8 additions and 12 deletions
|
@ -1976,7 +1976,10 @@ public class OsmandAidlApi {
|
|||
}
|
||||
|
||||
private boolean copyFileImpl(CopyFileParams fileParams, File file, String destination){
|
||||
LOG.debug(fileParams.toString());
|
||||
|
||||
if (fileParams.getFilePartData().length > 256*1024) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FileOutputStream fos;
|
||||
String key = fileParams.getFilename() + fileParams.getCopyStartTime();
|
||||
|
@ -1989,11 +1992,11 @@ public class OsmandAidlApi {
|
|||
file.renameTo(app.getAppPath(destination + fileParams.getFilename()));
|
||||
return true;
|
||||
|
||||
} else if (file.length() == fileParams.getSentSize()) {
|
||||
} else {
|
||||
fos.write(fileParams.getFilePartData());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
} else {
|
||||
file.getParentFile().mkdirs();
|
||||
fos = new FileOutputStream(file, true);
|
||||
|
|
|
@ -5,14 +5,12 @@ import android.os.Parcelable;
|
|||
|
||||
public class CopyFileParams implements Parcelable {
|
||||
private String filename;
|
||||
private long sentSize;
|
||||
private byte[] filePartData;
|
||||
private long copyStartTime;
|
||||
private boolean isTransmitComplete;
|
||||
|
||||
public CopyFileParams(String filename, long sentSize, byte[] filePartData, long copyStartTime, boolean isTransmitComplete) {
|
||||
public CopyFileParams(String filename, byte[] filePartData, long copyStartTime, boolean isTransmitComplete) {
|
||||
this.filename = filename;
|
||||
this.sentSize = sentSize;
|
||||
this.filePartData = filePartData;
|
||||
this.copyStartTime = copyStartTime;
|
||||
this.isTransmitComplete = isTransmitComplete;
|
||||
|
@ -22,9 +20,6 @@ public class CopyFileParams implements Parcelable {
|
|||
return filename;
|
||||
}
|
||||
|
||||
public long getSentSize() {
|
||||
return sentSize;
|
||||
}
|
||||
|
||||
public byte[] getFilePartData() {
|
||||
return filePartData;
|
||||
|
@ -39,7 +34,6 @@ public class CopyFileParams implements Parcelable {
|
|||
|
||||
protected CopyFileParams(Parcel in) {
|
||||
filename = in.readString();
|
||||
sentSize = in.readLong();
|
||||
filePartData = in.createByteArray();
|
||||
copyStartTime = in.readLong();
|
||||
isTransmitComplete = in.readByte() != 0;
|
||||
|
@ -66,7 +60,6 @@ public class CopyFileParams implements Parcelable {
|
|||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(filename);
|
||||
dest.writeLong(sentSize);
|
||||
dest.writeByteArray(filePartData);
|
||||
dest.writeLong(copyStartTime);
|
||||
dest.writeByte((byte) (isTransmitComplete ? 1 : 0));
|
||||
|
@ -74,7 +67,7 @@ public class CopyFileParams implements Parcelable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Filename: " + filename + ", sentSize = " + sentSize + ", filePartData size = " +
|
||||
return "Filename: " + filename + ", filePartData size = " +
|
||||
filePartData.length + ", startTime: " + copyStartTime + ", isTransmitComplete: "+ isTransmitComplete;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue