src/java.base/share/classes/sun/security/ssl/EngineOutputRecord.java

Print this page




  96         finishedMsg = false;
  97     }
  98 
  99     boolean isFinishedMsg() {
 100         return finishedMsg;
 101     }
 102 
 103     /*
 104      * Override the actual write below.  We do things this way to be
 105      * consistent with InputRecord.  InputRecord may try to write out
 106      * data to the peer, and *then* throw an Exception.  This forces
 107      * data to be generated/output before the exception is ever
 108      * generated.
 109      */
 110     @Override
 111     void writeBuffer(OutputStream s, byte [] buf, int off, int len,
 112             int debugOffset) throws IOException {
 113         /*
 114          * Copy data out of buffer, it's ready to go.
 115          */
 116         ByteBuffer netBB = (ByteBuffer)
 117             ByteBuffer.allocate(len).put(buf, off, len).flip();
 118 
 119         writer.putOutboundData(netBB);
 120     }
 121 
 122     /*
 123      * Main method for writing non-application data.
 124      * We MAC/encrypt, then send down for processing.
 125      */
 126     void write(Authenticator authenticator, CipherBox writeCipher)
 127             throws IOException {
 128 
 129         /*
 130          * Sanity check.
 131          */
 132         switch (contentType()) {
 133             case ct_change_cipher_spec:
 134             case ct_alert:
 135             case ct_handshake:
 136                 break;
 137             default:
 138                 throw new RuntimeException("unexpected byte buffers");




  96         finishedMsg = false;
  97     }
  98 
  99     boolean isFinishedMsg() {
 100         return finishedMsg;
 101     }
 102 
 103     /*
 104      * Override the actual write below.  We do things this way to be
 105      * consistent with InputRecord.  InputRecord may try to write out
 106      * data to the peer, and *then* throw an Exception.  This forces
 107      * data to be generated/output before the exception is ever
 108      * generated.
 109      */
 110     @Override
 111     void writeBuffer(OutputStream s, byte [] buf, int off, int len,
 112             int debugOffset) throws IOException {
 113         /*
 114          * Copy data out of buffer, it's ready to go.
 115          */
 116         ByteBuffer netBB = ByteBuffer.allocate(len).put(buf, off, len).flip();


 117         writer.putOutboundData(netBB);
 118     }
 119 
 120     /*
 121      * Main method for writing non-application data.
 122      * We MAC/encrypt, then send down for processing.
 123      */
 124     void write(Authenticator authenticator, CipherBox writeCipher)
 125             throws IOException {
 126 
 127         /*
 128          * Sanity check.
 129          */
 130         switch (contentType()) {
 131             case ct_change_cipher_spec:
 132             case ct_alert:
 133             case ct_handshake:
 134                 break;
 135             default:
 136                 throw new RuntimeException("unexpected byte buffers");