public void DoubleFarPointers() { var bytes = new byte[] { 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 7, 255, 127, 0, 0, 0, 0 }; var input = new ArrayInputStream(java.nio.ByteBuffer.wrap(bytes)); var message = Serialize.Read(input); var root = message.GetRoot(Test.TestAllTypes.SingleFactory); Assert.AreEqual(root.GetBoolField(), true); Assert.AreEqual(root.GetInt8Field(), 7); Assert.AreEqual(root.GetInt16Field(), 32767); }
/** * Returns a fault skin read from a file with specified name. * @param fileName the fault skin file name. * @return the fault skin. */ public static FaultSkin readFromFile(String fileName) { throw new NotImplementedException(); #if false FaultSkin skin = new FaultSkin(); try { ArrayInputStream ais = new ArrayInputStream(fileName); int ncell = ais.readInt(); int i1seed = ais.readInt(); int i2seed = ais.readInt(); int i3seed = ais.readInt(); List <FaultCell> cellList = new List <FaultCell>(ncell); for (int icell = 0; icell < ncell; ++icell) { float x1 = ais.readFloat(); float x2 = ais.readFloat(); float x3 = ais.readFloat(); float fl = ais.readFloat(); float fp = ais.readFloat(); float ft = ais.readFloat(); FaultCell cell = new FaultCell(x1, x2, x3, fl, fp, ft); cell.skin = skin; cellList.add(cell); cell.s1 = ais.readFloat(); cell.s2 = ais.readFloat(); cell.s3 = ais.readFloat(); } FaultCell[] cells = cellList.toArray(new FaultCell[0]); FaultCellGrid fcg = new FaultCellGrid(cells); for (FaultCell cell:cellList) { int i1a = ais.readInt(); int i2a = ais.readInt(); int i3a = ais.readInt(); int i1b = ais.readInt(); int i2b = ais.readInt(); int i3b = ais.readInt(); int i1l = ais.readInt(); int i2l = ais.readInt(); int i3l = ais.readInt(); int i1r = ais.readInt(); int i2r = ais.readInt(); int i3r = ais.readInt(); if (i1a != INULL) { cell.ca = fcg.get(i1a, i2a, i3a); } if (i1b != INULL) { cell.cb = fcg.get(i1b, i2b, i3b); } if (i1l != INULL) { cell.cl = fcg.get(i1l, i2l, i3l); } if (i1r != INULL) { cell.cr = fcg.get(i1r, i2r, i3r); } } ais.close(); skin._seed = fcg.get(i1seed, i2seed, i3seed); skin._cellList = cellList; } catch (Exception e) { throw new RuntimeException(e); } return(skin); #endif }