Added unit test for manifest X8 to X18 upgrade
This commit is contained in:
parent
f8eb41656a
commit
90e73d2d09
|
@ -73,6 +73,14 @@ public interface WarpManifestX0<T, M extends WarpManifestX0<T, M, H, S>, H exten
|
|||
return Optional.of(attr.get().getBody());
|
||||
}
|
||||
|
||||
default T getAttributeBodyNullable(T attributeName) {
|
||||
return getAttributeBodyNullable(attributeName, null);
|
||||
}
|
||||
|
||||
default T getAttributeBodyNullable(T attributeName, T defaultValue) {
|
||||
return getAttributeBody(attributeName).orElse(defaultValue);
|
||||
}
|
||||
|
||||
List<S> getSections();
|
||||
|
||||
S makeSection(T sectionName);
|
||||
|
@ -116,16 +124,11 @@ public interface WarpManifestX0<T, M extends WarpManifestX0<T, M, H, S>, H exten
|
|||
return section.get().getAttributeBody(attributeName);
|
||||
}
|
||||
|
||||
default T getSectionAttributeBodyPrivate(T sectionName, T attributeName) {
|
||||
return getSectionAttributeBodyPrivate(sectionName, attributeName, null);
|
||||
default T getSectionAttributeBodyNullable(T sectionName, T attributeName) {
|
||||
return getSectionAttributeBodyNullable(sectionName, attributeName, null);
|
||||
}
|
||||
|
||||
default T getSectionAttributeBodyPrivate(T sectionName, T attributeName, T defaultValue) {
|
||||
Optional<T> value = getSectionAttributeBody(sectionName, attributeName);
|
||||
if (value.isEmpty()) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return value.get();
|
||||
}
|
||||
default T getSectionAttributeBodyNullable(T sectionName, T attributeName, T defaultValue) {
|
||||
return getSectionAttributeBody(sectionName, attributeName).orElse(defaultValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright ©Δ∞ 仙上主天
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
|
||||
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
|
||||
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
|
||||
* even on air gaped systems, all information in the universe is owned by the pi creator.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package love.distributedrebirth.nx01.warp.manifestor.manifest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.x4o.o2o.fc18.FCDotCDC1604DashP6;
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeString;
|
||||
|
||||
/// Warp manifest 18 bit model importer from 8 bit model
|
||||
///
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
public final class WarpManifestX18Import {
|
||||
|
||||
static public WarpManifestX18 fromX8(WarpManifestX8 manifest) {
|
||||
WarpManifestX18 result = new WarpManifestX18();
|
||||
for (WarpManifestX8HeaderField attr : manifest.getAttributes()) {
|
||||
PrimordialOctalOrangeJuiceCord name = convertX8(attr.getName());
|
||||
PrimordialOctalOrangeJuiceCord body = convertX8(attr.getBody());
|
||||
WarpManifestX18HeaderField field = result.makeAttribute(name, body);
|
||||
convertRemarks(field, attr.getRemarks());
|
||||
}
|
||||
for (WarpManifestX8Section sectionX8 : manifest.getSections()) {
|
||||
PrimordialOctalOrangeJuiceCord sectionName = convertX8(sectionX8.getName());
|
||||
WarpManifestX18Section sectionX18 = result.makeSection(sectionName);
|
||||
for (String remark : sectionX8.getRemarks()) {
|
||||
sectionX18.withRemark(convertX8(remark));
|
||||
}
|
||||
for (WarpManifestX8HeaderField attr : sectionX8.getAttributes()) {
|
||||
PrimordialOctalOrangeJuiceCord name = convertX8(attr.getName());
|
||||
PrimordialOctalOrangeJuiceCord body = convertX8(attr.getBody());
|
||||
WarpManifestX18HeaderField field = sectionX18.makeAttribute(name, body);
|
||||
convertRemarks(field, attr.getRemarks());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static private void convertRemarks(WarpManifestX18HeaderField field, List<String> remarks) {
|
||||
for (String remark : remarks) {
|
||||
field.withRemark(convertX8(remark));
|
||||
}
|
||||
}
|
||||
|
||||
static private PrimordialOctalOrangeJuiceCord convertX8(String value) {
|
||||
List<FCDotCDC1604DashP6> fc18 = FCDotCDC1604DashP6.convertFromUnicode(value);
|
||||
List<Integer> fc18Num = fc18.stream().map(v -> v.ordinal()).toList();
|
||||
return PrimordialOctalOrangeString.valueOfSmurfs(fc18Num);
|
||||
}
|
||||
}
|
|
@ -27,9 +27,13 @@
|
|||
|
||||
package love.distributedrebirth.nx01.warp.manifestor;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX18Import;
|
||||
import love.distributedrebirth.nx01.warp.manifestor.manifest.WarpManifestX8;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
|
@ -57,4 +61,19 @@ public class WarpManifestorDriverTest {
|
|||
Assertions.assertEquals(checkWrap, manitest.getAttributeBody("Scm-Url").get());
|
||||
Assertions.assertEquals(checkWrapLast, manitest.getAttributeBody("Implementation-URL").get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSizeOfVersions() {
|
||||
WarpManifestX8 manitest = WarpManifestorDriver.亞.readV1Stream(getClass().getResourceAsStream("test-line-wrap.mf"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
WarpManifestX18 manitestX18 = WarpManifestX18Import.fromX8(manitest);
|
||||
Assertions.assertNotNull(manitestX18);
|
||||
|
||||
System.out.println("size-OF: " + manitest.getAttributeBodyNullable("Implementation-Vendor-Id"));
|
||||
System.out.println("size-V1: " + WarpManifestorDriver.亞.writeV1String(manitest).getBytes(StandardCharsets.UTF_8).length);
|
||||
System.out.println("size-V2: " + WarpManifestorDriver.亞.writeV2String(manitest).getBytes(StandardCharsets.UTF_8).length);
|
||||
System.out.println("size-V3: " + WarpManifestorDriver.亞.writeV3Array(manitest).length);
|
||||
System.out.println("size-V4: " + WarpManifestorDriver.亞.writeV4Array(manitestX18).length);
|
||||
System.out.println("size-V5: " + WarpManifestorDriver.亞.writeV5Array(manitest).length);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public class WarpManifestorVIniTest {
|
|||
WarpManifestX8 manitest = WarpManifestorDriver.亞.readViniStream(getClass().getResourceAsStream("ini/test-ntp.service"));
|
||||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(3, manitest.getSections().size());
|
||||
Assertions.assertEquals("Network Time Service", manitest.getSectionAttributeBodyPrivate("Unit", "Description"));
|
||||
Assertions.assertEquals("man:ntpd(8)", manitest.getSectionAttributeBodyPrivate("Unit", "Documentation"));
|
||||
Assertions.assertEquals("Network Time Service", manitest.getSectionAttributeBodyNullable("Unit", "Description"));
|
||||
Assertions.assertEquals("man:ntpd(8)", manitest.getSectionAttributeBodyNullable("Unit", "Documentation"));
|
||||
//System.out.println(WarpManifestorDriver.亞.writeViniString(manitest));
|
||||
}
|
||||
|
||||
|
@ -53,18 +53,18 @@ public class WarpManifestorVIniTest {
|
|||
Assertions.assertEquals(3, manitest.getSections().size());
|
||||
|
||||
Assertions.assertEquals("last modified 1 April 2001 by John Doe", manitest.getSection("owner").get().getRemarks().get(0));
|
||||
Assertions.assertEquals("John Doe", manitest.getSectionAttributeBodyPrivate("owner", "name"));
|
||||
Assertions.assertEquals("Acme Widgets Inc.", manitest.getSectionAttributeBodyPrivate("owner", "organization"));
|
||||
Assertions.assertEquals("John Doe", manitest.getSectionAttributeBodyNullable("owner", "name"));
|
||||
Assertions.assertEquals("Acme Widgets Inc.", manitest.getSectionAttributeBodyNullable("owner", "organization"));
|
||||
|
||||
Assertions.assertEquals("192.0.2.62", manitest.getSectionAttributeBodyPrivate("database", "server"));
|
||||
Assertions.assertEquals("143", manitest.getSectionAttributeBodyPrivate("database", "port"));
|
||||
Assertions.assertEquals("payroll.dat", manitest.getSectionAttributeBodyPrivate("database", "file"));
|
||||
Assertions.assertEquals("192.0.2.62", manitest.getSectionAttributeBodyNullable("database", "server"));
|
||||
Assertions.assertEquals("143", manitest.getSectionAttributeBodyNullable("database", "port"));
|
||||
Assertions.assertEquals("payroll.dat", manitest.getSectionAttributeBodyNullable("database", "file"));
|
||||
Assertions.assertEquals("use IP address in case network name resolution is not working", manitest.getSectionAttribute("database", "server").get().getRemarks().get(0));
|
||||
|
||||
Assertions.assertEquals("key=v", manitest.getSectionAttributeBodyPrivate("keys", "key"));
|
||||
Assertions.assertEquals("value", manitest.getSectionAttributeBodyPrivate("keys", "name"));
|
||||
Assertions.assertEquals(";", manitest.getSectionAttributeBodyPrivate("keys", "sem"));
|
||||
Assertions.assertEquals("v5822.433.2", manitest.getSectionAttributeBodyPrivate("keys", "semver"));
|
||||
Assertions.assertEquals("key=v", manitest.getSectionAttributeBodyNullable("keys", "key"));
|
||||
Assertions.assertEquals("value", manitest.getSectionAttributeBodyNullable("keys", "name"));
|
||||
Assertions.assertEquals(";", manitest.getSectionAttributeBodyNullable("keys", "sem"));
|
||||
Assertions.assertEquals("v5822.433.2", manitest.getSectionAttributeBodyNullable("keys", "semver"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -73,22 +73,22 @@ public class WarpManifestorVIniTest {
|
|||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(6, manitest.getSections().size());
|
||||
|
||||
Assertions.assertEquals("orchard rental service (with app)", manitest.getSectionAttributeBodyPrivate("project", "name"));
|
||||
Assertions.assertEquals("Bay Area", manitest.getSectionAttributeBodyPrivate("project", "target region"));
|
||||
Assertions.assertEquals("(vacant)", manitest.getSectionAttributeBodyPrivate("project", "legal team"));
|
||||
Assertions.assertEquals("orchard rental service (with app)", manitest.getSectionAttributeBodyNullable("project", "name"));
|
||||
Assertions.assertEquals("Bay Area", manitest.getSectionAttributeBodyNullable("project", "target region"));
|
||||
Assertions.assertEquals("(vacant)", manitest.getSectionAttributeBodyNullable("project", "legal team"));
|
||||
Assertions.assertEquals("TODO: advertise vacant positions", manitest.getSectionAttribute("project", "legal team").get().getRemarks().get(0));
|
||||
|
||||
Assertions.assertEquals("foreseeable", manitest.getSectionAttributeBodyPrivate("fruit \"Apple\"", "trademark issues"));
|
||||
Assertions.assertEquals("known", manitest.getSectionAttributeBodyPrivate("fruit \"Apple\"", "taste"));
|
||||
Assertions.assertEquals("foreseeable", manitest.getSectionAttributeBodyNullable("fruit \"Apple\"", "trademark issues"));
|
||||
Assertions.assertEquals("known", manitest.getSectionAttributeBodyNullable("fruit \"Apple\"", "taste"));
|
||||
|
||||
Assertions.assertEquals("logistics (fragile fruit)", manitest.getSectionAttributeBodyPrivate("fruit \"Raspberry\"", "anticipated problems"));
|
||||
Assertions.assertEquals("possible", manitest.getSectionAttributeBodyPrivate("fruit \"Raspberry\"", "Trademark Issues"));
|
||||
Assertions.assertEquals("logistics (fragile fruit)", manitest.getSectionAttributeBodyNullable("fruit \"Raspberry\"", "anticipated problems"));
|
||||
Assertions.assertEquals("possible", manitest.getSectionAttributeBodyNullable("fruit \"Raspberry\"", "Trademark Issues"));
|
||||
|
||||
Assertions.assertEquals("2021-11-23, 08:54 +0900", manitest.getSectionAttributeBodyPrivate("fruit.raspberry.proponents.fred", "date"));
|
||||
Assertions.assertEquals("I like red fruit.", manitest.getSectionAttributeBodyPrivate("fruit.raspberry.proponents.fred", "comment"));
|
||||
Assertions.assertEquals("2021-11-23, 08:54 +0900", manitest.getSectionAttributeBodyNullable("fruit.raspberry.proponents.fred", "date"));
|
||||
Assertions.assertEquals("I like red fruit.", manitest.getSectionAttributeBodyNullable("fruit.raspberry.proponents.fred", "comment"));
|
||||
|
||||
Assertions.assertEquals("Why,I would buy dates.", manitest.getSectionAttributeBodyPrivate("fruit \"Date/proponents/alfred\"", "comment"));
|
||||
Assertions.assertEquals("My name may contain a \nnewline.", manitest.getSectionAttributeBodyPrivate("fruit \"Date/proponents/alfred\"", "editor"));
|
||||
Assertions.assertEquals("Why,I would buy dates.", manitest.getSectionAttributeBodyNullable("fruit \"Date/proponents/alfred\"", "comment"));
|
||||
Assertions.assertEquals("My name may contain a \nnewline.", manitest.getSectionAttributeBodyNullable("fruit \"Date/proponents/alfred\"", "editor"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -111,28 +111,28 @@ public class WarpManifestorVIniTest {
|
|||
Assertions.assertNotNull(manitest);
|
||||
Assertions.assertEquals(3, manitest.getSections().size());
|
||||
|
||||
Assertions.assertEquals("'Junit'", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single"));
|
||||
Assertions.assertEquals("Junit\'s hell0", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single_center"));
|
||||
Assertions.assertEquals("Junit\'", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single_right"));
|
||||
Assertions.assertEquals("\'Junit", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_single_left"));
|
||||
Assertions.assertEquals("'Junit'", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single"));
|
||||
Assertions.assertEquals("Junit\'s hell0", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single_center"));
|
||||
Assertions.assertEquals("Junit\'", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single_right"));
|
||||
Assertions.assertEquals("\'Junit", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_single_left"));
|
||||
|
||||
Assertions.assertEquals("\"Junit\"", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double"));
|
||||
Assertions.assertEquals("Junit\"s hell0", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double_center"));
|
||||
Assertions.assertEquals("Junit\"", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double_right"));
|
||||
Assertions.assertEquals("\"Junit", manitest.getSectionAttributeBodyPrivate("EscQuote", "quote_double_left"));
|
||||
Assertions.assertEquals("\"Junit\"", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double"));
|
||||
Assertions.assertEquals("Junit\"s hell0", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double_center"));
|
||||
Assertions.assertEquals("Junit\"", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double_right"));
|
||||
Assertions.assertEquals("\"Junit", manitest.getSectionAttributeBodyNullable("EscQuote", "quote_double_left"));
|
||||
|
||||
Assertions.assertEquals("Junit\thell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "tab"));
|
||||
Assertions.assertEquals("Junit\\hell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "backslash"));
|
||||
Assertions.assertEquals("Junit\nhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "line_feed"));
|
||||
Assertions.assertEquals("Junit\rhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "carriage_return"));
|
||||
Assertions.assertEquals("Junit\0hell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "null_character"));
|
||||
Assertions.assertEquals("Junit\bhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "backspace"));
|
||||
Assertions.assertEquals("Junit\fhell0", manitest.getSectionAttributeBodyPrivate("EscCharNative", "form_feed"));
|
||||
Assertions.assertEquals("Junit\thell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "tab"));
|
||||
Assertions.assertEquals("Junit\\hell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "backslash"));
|
||||
Assertions.assertEquals("Junit\nhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "line_feed"));
|
||||
Assertions.assertEquals("Junit\rhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "carriage_return"));
|
||||
Assertions.assertEquals("Junit\0hell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "null_character"));
|
||||
Assertions.assertEquals("Junit\bhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "backspace"));
|
||||
Assertions.assertEquals("Junit\fhell0", manitest.getSectionAttributeBodyNullable("EscCharNative", "form_feed"));
|
||||
|
||||
Assertions.assertEquals("Junit;hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "semicolon"));
|
||||
Assertions.assertEquals("Junit#hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "number_sign"));
|
||||
Assertions.assertEquals("Junit=hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "equals_sign"));
|
||||
Assertions.assertEquals("Junit:hell0", manitest.getSectionAttributeBodyPrivate("EscCharOther", "colon"));
|
||||
Assertions.assertEquals("str1;str2;str3", manitest.getSectionAttributeBodyPrivate("EscCharOther", "quote_semi_colons"));
|
||||
Assertions.assertEquals("Junit;hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "semicolon"));
|
||||
Assertions.assertEquals("Junit#hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "number_sign"));
|
||||
Assertions.assertEquals("Junit=hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "equals_sign"));
|
||||
Assertions.assertEquals("Junit:hell0", manitest.getSectionAttributeBodyNullable("EscCharOther", "colon"));
|
||||
Assertions.assertEquals("str1;str2;str3", manitest.getSectionAttributeBodyNullable("EscCharOther", "quote_semi_colons"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.x4o.o2o.octal.PrimordialOctalIterator;
|
|||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuice;
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeJuiceCord;
|
||||
import org.x4o.o2o.octal.PrimordialOctalOrangeSexWord;
|
||||
import org.x4o.o2o.octal.PrimordialOctalSkullBait;
|
||||
|
||||
/// @author للَّٰهِilLצسُو
|
||||
/// @version ©Δ∞ 仙上主天
|
||||
|
@ -88,11 +89,13 @@ public final class TLVChainOctalSex
|
|||
throw new IllegalStateException("Data frame segment to large: " + data.length);
|
||||
}
|
||||
PrimordialOctalOrangeJuice prolog = frame.getSegmentProlog();
|
||||
PrimordialOctal.valuesToSmurfs(output, prolog.baitOctalIterator());
|
||||
PrimordialOctal.valuesToSmurfs(output, PrimordialOctalOrangeSexWord.valueOfSmurf(data.length).baitOctalIterator());
|
||||
List<PrimordialOctalSkullBait> octals = new ArrayList<>();
|
||||
PrimordialOctalIterator.valuesTo(octals, prolog.baitOctalIterator());
|
||||
PrimordialOctalIterator.valuesTo(octals, PrimordialOctalOrangeSexWord.valueOfSmurf(data.length).baitOctalIterator());
|
||||
for (int dataIdx = 0; dataIdx < data.length; dataIdx++) {
|
||||
PrimordialOctal.valuesToSmurfs(output, data[dataIdx].baitOctalIterator());
|
||||
PrimordialOctalIterator.valuesTo(octals, data[dataIdx].baitOctalIterator());
|
||||
}
|
||||
PrimordialOctal.valuesToSmurfs(output, PrimordialOctalIterator.valuesFrom(octals));
|
||||
output.flush();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,14 +126,14 @@ public enum PrimordialOctal implements PrimordialOctalSkullBait {
|
|||
int totalBytes = 0;
|
||||
while (read.hasNext()) {
|
||||
int byteTriplet = 0;
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_1);
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_2);
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_3);
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_4);
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_5);
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_6);
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_7);
|
||||
byteTriplet += read.next().ordinalOctalShiftSmurf(PART_8);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_1);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_2);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_3);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_4);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_5);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_6);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_7);
|
||||
byteTriplet += !read.hasNext()?0:read.next().ordinalOctalShiftSmurf(PART_8);
|
||||
output.write(byteTriplet);
|
||||
output.write(byteTriplet >> SHIFT_8);
|
||||
output.write(byteTriplet >> SHIFT_16);
|
||||
|
|
|
@ -102,4 +102,10 @@ public interface PrimordialOctalIterator extends PrimitiveIterator<PrimordialOct
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void valuesTo(List<PrimordialOctalSkullBait> sink, PrimordialOctalIterator values) {
|
||||
while (values.hasNext()) {
|
||||
sink.add(values.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue