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

Method WriteToken

examples/GssUtil.java:55–87  ·  view source on GitHub ↗
(OutputStream outStream, byte[] outputToken)

Source from the content-addressed store, hash-verified

53 * Return: 0 on success, -1 on failure
54 */
55 public static int WriteToken(OutputStream outStream, byte[] outputToken)
56 {
57 if (DEBUG)
58 System.out.println("Entered WriteToken...");
59
60 try {
61
62 /* First send the size of our byte array */
63 byte[] size = Util.intToByteArray(outputToken.length);
64
65 if (DEBUG)
66 System.out.println("... sending byte array size: " +
67 Util.byteArrayToInt(size));
68 outStream.write(size);
69
70 /* Now send our actual byte array */
71 if (DEBUG) {
72 System.out.println("... sending byte array: ");
73 printByteArray(outputToken);
74 System.out.println("... outputToken.length = " +
75 outputToken.length);
76 }
77 outStream.write(outputToken);
78
79 return 0;
80
81 } catch (IOException e) {
82
83 e.printStackTrace();
84 return -1;
85
86 }
87 }
88
89 /*
90 * Read a token byte[] from InputStream.

Callers 3

mainMethod · 0.95
establishContextMethod · 0.95
doCommunicationMethod · 0.95

Calls 3

intToByteArrayMethod · 0.95
byteArrayToIntMethod · 0.95
printByteArrayMethod · 0.95

Tested by

no test coverage detected