1 28 29 package com.caucho.iiop; 30 31 import java.io.IOException ; 32 33 abstract public class MessageWriter { 34 37 public void start10Message(int type) 38 { 39 } 40 41 44 public void start11Message(int type) 45 { 46 } 47 48 51 public void start12Message(int type, int requestId) 52 { 53 } 54 55 58 abstract public int getOffset(); 59 60 63 abstract public void write(int v); 64 65 68 abstract public void write(byte []buffer, int offset, int length); 69 70 73 public void writeShort(int v) 74 { 75 write(v >> 8); 76 write(v); 77 } 78 79 82 public void writeChar(char v) 83 { 84 write(v >> 8); 85 write(v); 86 } 87 88 91 public void writeInt(int v) 92 { 93 write(v >> 24); 94 write(v >> 16); 95 write(v >> 8); 96 write(v); 97 } 98 99 102 public void writeLong(long v) 103 { 104 write((int) (v >> 56)); 105 write((int) (v >> 48)); 106 write((int) (v >> 40)); 107 write((int) (v >> 32)); 108 109 write((int) (v >> 24)); 110 write((int) (v >> 16)); 111 write((int) (v >> 8)); 112 write((int) v); 113 } 114 115 118 public void align(int v) 119 { 120 int offset = getOffset(); 121 122 while (offset % v != 0) { 123 offset++; 124 write(0); 125 } 126 } 127 128 131 abstract public void close() 132 throws IOException ; 133 } 134 | Popular Tags |