mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2024-12-21 17:29:55 +00:00
Adding default option for 'acx import' to use raw/binary. #122
This commit is contained in:
parent
0bccdde28a
commit
bdc60cad2c
@ -27,11 +27,7 @@ import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Queue;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@ -73,7 +69,7 @@ public class ImportCommand extends ReadWriteDiskCommandOptions {
|
||||
private InputData inputData;
|
||||
|
||||
@ArgGroup(heading = "%nProcessing options:%n")
|
||||
private Processor processor;
|
||||
private Processor processor = new Processor();
|
||||
|
||||
@ArgGroup(heading = "%nGeneral overrides:%n", exclusive = false)
|
||||
private Overrides overrides = new Overrides();
|
||||
@ -175,12 +171,17 @@ public class ImportCommand extends ReadWriteDiskCommandOptions {
|
||||
}
|
||||
|
||||
public static class Processor {
|
||||
private Function<FileEntryReader,List<FileEntryReader>> fileEntryReaderFn;
|
||||
private Function<FileEntryReader,List<FileEntryReader>> fileEntryReaderFn = this::handleRawFile;
|
||||
|
||||
public List<FileEntryReader> apply(FileEntryReader reader) {
|
||||
return fileEntryReaderFn.apply(reader);
|
||||
}
|
||||
|
||||
@Option(names = { "--raw", "--binary" }, description = { "Import as a raw binary file." })
|
||||
public void setRawBinaryMode(boolean flag) {
|
||||
fileEntryReaderFn = this::handleRawFile;
|
||||
}
|
||||
|
||||
@Option(names = { "--text", "--text-high" }, description = {
|
||||
"Import as a text file, setting high bit and ",
|
||||
"replacing newline characters with $8D." })
|
||||
@ -221,6 +222,10 @@ public class ImportCommand extends ReadWriteDiskCommandOptions {
|
||||
fileEntryReaderFn = this::handleShrinkitMode;
|
||||
}
|
||||
|
||||
private List<FileEntryReader> handleRawFile(FileEntryReader reader) {
|
||||
return Arrays.asList(reader);
|
||||
}
|
||||
|
||||
private List<FileEntryReader> handleTextModeSetHighBit(FileEntryReader reader) {
|
||||
InputStream inputStream = new ByteArrayInputStream(reader.getFileData().get());
|
||||
return handleTextMode(TranslatorStream.builder(inputStream)
|
||||
|
Loading…
Reference in New Issue
Block a user