我尝试通过套接字从delphi发送编码文件到android 我使用的是delphi xe4
这是我的delphi代码
procedure sendData();
begin
dbdata = encodeFile('D:\data.sql');
Memo1.Text := dbdata;
ssMobile.Socket.Connections[cmbDevice.ItemIndex].SendText(dbdata + #10#13);
end;
这是我的安卓代码
private void receiveFile() {
try {
BufferedReader input = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
String read = input.readLine();
if (!read.isEmpty()) {
if (read.contains("enddb")){
isFile = false;
}
byte[] dbAsBytes = read.getBytes();
File filePath = new File(Environment.getExternalStorageDirectory()+"/data.sql");
FileOutputStream os = new FileOutputStream(filePath, true);
os.write(dbAsBytes);
os.flush();
os.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
这是我的memo1.text
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAAAAPAAAAAkAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAkA
AAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AC3iJw0PowAHBn8AD6cL+Q9u
C5cG1QtuBn8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
这是我收到的文件
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAAAAPAAAAAkAAAAAAAAAAAAAAAUAAAAEAAAAAAAAAAkA
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAAAAPAAAAA
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAAAAPAAA
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAAAAPA
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAAAA
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAgAA
U1FMaXRlIGZvcm1hdCAzABAAAQEAQCAg
我的代码出了什么问题? 我收到的文件与我发送的数据不一样?