MCPcopy Create free account
hub / github.com/cconlon/kerberos-java-gssapi / WriteToken

Method WriteToken

examples/Util.java:107–139  ·  view source on GitHub ↗
(OutputStream outStream, byte[] outputToken)

Source from the content-addressed store, hash-verified

105 * Return: 0 on success, -1 on failure
106 */
107 public static int WriteToken(OutputStream outStream, byte[] outputToken)
108 {
109 if (DEBUG)
110 System.out.println("Entered WriteToken...");
111
112 try {
113
114 /* First send the size of our byte array */
115 byte[] size = Util.intToByteArray(outputToken.length);
116
117 if (DEBUG)
118 System.out.println("... sending byte array size: " +
119 Util.byteArrayToInt(size));
120 outStream.write(size);
121
122 /* Now send our actual byte array */
123 if (DEBUG) {
124 System.out.println("... sending byte array: ");
125 printByteArray(outputToken);
126 System.out.println("... outputToken.length = " +
127 outputToken.length);
128 }
129 outStream.write(outputToken);
130
131 return 0;
132
133 } catch (IOException e) {
134
135 e.printStackTrace();
136 return -1;
137
138 }
139 }
140
141 /*
142 * Read a token byte[] from InputStream.

Callers 6

AuthenticateMethod · 0.95
CommunicateMethod · 0.95
AltCommunicateMethod · 0.95
AuthenticateMethod · 0.95
CommunicateMethod · 0.95
AltCommunicateMethod · 0.95

Calls 3

intToByteArrayMethod · 0.95
byteArrayToIntMethod · 0.95
printByteArrayMethod · 0.95

Tested by

no test coverage detected