Ich habe ein Problem mit dem Speicherzugriffs -Framework, das keine Dateikopien korrekt nennt. Basisfileiname, also erhalte ich < /p>
ahoot.db3(1) anstelle von ahoot (1) .db3. Die Datei beim Speichern korrekt, aber ich weiß nicht, wie SAF die Datei kopiert, damit die Erweiterung gleich bleibt. < /p>
File destination = new File(DEST_PATH + File.separator + DB_NAME);
int num = 0;
while (destination.exists()) {
num++;
String[] alt = DB_NAME.split("\\.(?=[^\\.]+$)"); // CHANGE
destination = new File(DEST_PATH + File.separator + alt[0] + "(" + num + ")" + "." + alt[1]);
}
< /code>
Verwenden von URI < /p>
public void copyUriDatabase(InputStream in, Uri destinationUri) {
try {
OutputStream out = null;
out = this.getContentResolver().openOutputStream(destinationUri);
byte[] buffer = new byte[1024];
int read;
try {
while ((in.read(buffer)) > 0) {
if (out != null) {
out.write(buffer);
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
if (out != null) {
out.flush();
out.close();
}
in.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
< /code>
Die URI stammt von
URI destinationuri = resultdata.getData (); < /p>
Ich habe ein Problem mit dem Speicherzugriffs -Framework, das keine Dateikopien korrekt nennt. Basisfileiname, also erhalte ich < /p> ahoot.db3(1) anstelle von ahoot (1) .db3. Die Datei beim Speichern korrekt, aber ich weiß nicht, wie SAF die Datei kopiert, damit die Erweiterung gleich bleibt. < /p> File destination = new File(DEST_PATH + File.separator + DB_NAME); int num = 0; while (destination.exists()) { num++; String[] alt = DB_NAME.split("\\.(?=[^\\.]+$)"); // CHANGE destination = new File(DEST_PATH + File.separator + alt[0] + "(" + num + ")" + "." + alt[1]); } < /code> Verwenden von URI < /p> public void copyUriDatabase(InputStream in, Uri destinationUri) { try { OutputStream out = null; out = this.getContentResolver().openOutputStream(destinationUri);
byte[] buffer = new byte[1024]; int read;
try { while ((in.read(buffer)) > 0) { if (out != null) { out.write(buffer); } } } catch (IOException e) { throw new RuntimeException(e); }
if (out != null) { out.flush();
out.close(); } in.close(); } catch (IOException e) { throw new RuntimeException(e); } } < /code> Die URI stammt von URI destinationuri = resultdata.getData (); < /p>
Ich habe ein Problem mit dem Speicherzugriffs -Framework, das keine Dateikopien korrekt nennt. Basisfileiname, also erhalte ich
ahoot.db3(1) anstelle von ahoot (1) .db3. Die Datei beim Speichern...
Angenommen, ich habe eine Sequenz von Bytes von C oder einer anderen nativen Plattform, die auf dem JVM als Java.lang.foreign.Memorysegment und in int (oder was auch immer) ausgedrückt wird. Diese...
Ich habe eine Schnittstelle, die zuerst Daten von einer Drittanbieter-API abruft und dann JSON zur Anzeige an das Frontend zurückgibt.
Beispiel für die Antwort der Drittanbieter-API :
{
ShipperCode...
Ich habe eine Schnittstelle, die zuerst Daten von einer Drittanbieter-API abruft und dann JSON zur Anzeige an das Frontend zurückgibt.
Beispiel für die Antwort der Drittanbieter-API :
{
ShipperCode...
Ich habe eine Schnittstelle, die zuerst Daten von einer Drittanbieter-API abruft und dann JSON zur Anzeige an das Frontend zurückgibt.
Beispiel für die Antwort der Drittanbieter-API :
{
ShipperCode...