Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Liu <frank.liu@ishisystems.com>2014-04-17 09:17:32 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-04-17 09:17:32 +0400
commit65f345d7758d46deb82ccaeed7af38c5d498ece5 (patch)
treedb209881b3c229cb48047a087040d93b504e1c7b /core/src/main/java/org
parentf7adc48ced97d3c6849590d5622ebe1ef4f9ad31 (diff)
BJA-483 Implement available() on TlsInputStream
Diffstat (limited to 'core/src/main/java/org')
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/tls/TlsInputStream.java6
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/tls/TlsProtocol.java6
2 files changed, 12 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/TlsInputStream.java b/core/src/main/java/org/bouncycastle/crypto/tls/TlsInputStream.java
index 9509dc4f..a2cf74e8 100644
--- a/core/src/main/java/org/bouncycastle/crypto/tls/TlsInputStream.java
+++ b/core/src/main/java/org/bouncycastle/crypto/tls/TlsInputStream.java
@@ -17,6 +17,12 @@ class TlsInputStream
this.handler = handler;
}
+ public int available()
+ throws IOException
+ {
+ return this.handler.applicationDataAvailable();
+ }
+
public int read(byte[] buf, int offset, int len)
throws IOException
{
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/TlsProtocol.java b/core/src/main/java/org/bouncycastle/crypto/tls/TlsProtocol.java
index 85fdd3ec..9e6d73ae 100644
--- a/core/src/main/java/org/bouncycastle/crypto/tls/TlsProtocol.java
+++ b/core/src/main/java/org/bouncycastle/crypto/tls/TlsProtocol.java
@@ -392,6 +392,12 @@ public abstract class TlsProtocol
}
}
+ protected int applicationDataAvailable()
+ throws IOException
+ {
+ return applicationDataQueue.size();
+ }
+
/**
* Read data from the network. The method will return immediately, if there is still some data
* left in the buffer, or block until some application data has been read from the network.