Готовая лабораторная работа 7
This commit is contained in:
parent
5ec534d436
commit
4cc1f29e3e
@ -29,14 +29,14 @@ public class TanksGenericStorage {
|
|||||||
data.append(key).append("\n");
|
data.append(key).append("\n");
|
||||||
for (DrawingArmoVehicle elem: _tankStorages.get(key).getTanks(100)) {
|
for (DrawingArmoVehicle elem: _tankStorages.get(key).getTanks(100)) {
|
||||||
if(_tankStorages.get(key) == null)
|
if(_tankStorages.get(key) == null)
|
||||||
throw new InvalidPropertiesFormatException("");
|
throw new InvalidPropertiesFormatException("Ключ не найден. Сохранение невозможно");
|
||||||
|
|
||||||
if(_tankStorages.get(key) != null)
|
if(_tankStorages.get(key) != null)
|
||||||
data.append(elem != null ? ExtentionDrawingTank.GetDataForSave(elem, _separatorForObjectWR) + "\n" : "");
|
data.append(elem != null ? ExtentionDrawingTank.GetDataForSave(elem, _separatorForObjectWR) + "\n" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.length() == 0)
|
if(data.length() == 0)
|
||||||
throw new InvalidStreamException("File not found, нет данных для сохранения");
|
throw new InvalidStreamException("Нет данных для сохранения");
|
||||||
|
|
||||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filename))) {
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filename))) {
|
||||||
writer.write("TankStorageSingle" + System.lineSeparator() + data.toString());
|
writer.write("TankStorageSingle" + System.lineSeparator() + data.toString());
|
||||||
@ -110,7 +110,7 @@ public class TanksGenericStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.length() == 0)
|
if (data.length() == 0)
|
||||||
throw new InvalidStreamException("File not found, нет данных для сохранения");
|
throw new InvalidStreamException("Нет данных для сохранения");
|
||||||
|
|
||||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filename))) {
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(filename))) {
|
||||||
writer.write("TankStorage" + System.lineSeparator() + data.toString());
|
writer.write("TankStorage" + System.lineSeparator() + data.toString());
|
||||||
|
Loading…
Reference in New Issue
Block a user