Package net.sourceforge.jtds.ssl
Class TdsTlsOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
net.sourceforge.jtds.ssl.TdsTlsOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
An output stream that mediates between JSSE and the DB server.
SQL Server 2000 has the following requirements:
- All handshake records are delivered in TDS packets.
- The "Client Key Exchange" (CKE), "Change Cipher Spec" (CCS) and "Finished" (FIN) messages are to be submitted in the delivered in both the same TDS packet and the same TCP packet.
- From then on TLS/SSL records should be transmitted as normal -- the TDS packet is part of the encrypted application data.
- Version:
- $Id: TdsTlsOutputStream.java,v 1.4 2005-04-28 14:29:31 alin_sinpalean Exp $
- Author:
- Rob Worsnop, Mike Hutchinson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ListUsed for holding back CKE, CCS and FIN records.private intFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a TdsTlsOutputStream based on an underlying output stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddeferRecord(byte[] record, int len) Holds back a record for batched transmission.voidflush()private voidTransmits the buffered batch of records.(package private) voidputTdsPacket(byte[] b, int len) Write a TDS packet containing the TLS record(s).voidwrite(byte[] b, int off, int len) Methods inherited from class java.io.FilterOutputStream
close, write, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
bufferedRecords
Used for holding back CKE, CCS and FIN records. -
totalSize
private int totalSize
-
-
Constructor Details
-
TdsTlsOutputStream
TdsTlsOutputStream(OutputStream out) Constructs a TdsTlsOutputStream based on an underlying output stream.- Parameters:
out- the underlying output stream
-
-
Method Details
-
deferRecord
private void deferRecord(byte[] record, int len) Holds back a record for batched transmission.- Parameters:
record- the TLS record to bufferlen- the length of the TLS record to buffer
-
flushBufferedRecords
Transmits the buffered batch of records.- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
putTdsPacket
Write a TDS packet containing the TLS record(s).- Parameters:
b- the TLS recordlen- the length of the TLS record- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException
-