code: public static void writeTIN(ByteWriter writer, TIN tin) throws IOException {
  
  		writer.writeInt(tin.numPolygons());
  
  		for (Polygon polygon : tin.getPolygons()) {
  			writeGeometry(writer, polygon);
  		}
  	}
docs: Write a TIN
  
  @param writer
  @param tin
  @throws IOException