+
+ public static InputStream write(MicroInstructionMemory memory)
+ {
+ return new InputStream()
+ {
+ long instIndex = memory.getDefinition().getMinimalAddress(), maxAddress = memory.getDefinition().getMaximalAddress();
+ InputStream instStream = new ByteArrayInputStream(new byte[0]);
+
+ @Override
+ public int read() throws IOException
+ {
+ int val = instStream.read();
+ if (val == -1 && instIndex <= maxAddress)
+ {
+ instStream = new ByteArrayInputStream((toCSV(memory.getCell(instIndex++)) + lineSeparator).getBytes());
+ val = instStream.read();
+ }
+ return val;
+ }
+ };
+ }