summaryrefslogtreecommitdiff
path: root/javaunohelper/com/sun/star
diff options
context:
space:
mode:
authorJörg Budischewski <jbu@openoffice.org>2002-03-05 11:19:33 +0000
committerJörg Budischewski <jbu@openoffice.org>2002-03-05 11:19:33 +0000
commit1646c90dc2635357af205b01f9e5ce768aa5ba37 (patch)
tree31d566417e870c105c6491989866fabd26d7c3d3 /javaunohelper/com/sun/star
parentf63cb5ac9ae4bea468725e65799e801f4d4f524d (diff)
#97580# by B.Cameron : skip() is now int64 save
Diffstat (limited to 'javaunohelper/com/sun/star')
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
index e885ab7d2964..154d8c64b120 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
@@ -2,9 +2,9 @@
*
* $RCSfile: XInputStreamToInputStreamAdapter.java,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jbu $ $Date: 2002-02-15 17:56:04 $
+ * last change: $Author: jbu $ $Date: 2002-03-05 12:19:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -179,6 +179,8 @@ public class XInputStreamToInputStreamAdapter extends InputStream {
public long skip(long n) throws IOException {
+ long tmpLongVal = n;
+ int tmpIntVal;
int avail;
try {
@@ -187,11 +189,21 @@ public class XInputStreamToInputStreamAdapter extends InputStream {
throw new IOException(e.toString());
}
- try {
- xin.skipBytes((int)n);
- } catch (Exception e) {
- throw new IOException(e.toString());
- }
+ do {
+ if (tmpLongVal >= Integer.MAX_VALUE) {
+ tmpIntVal = Integer.MAX_VALUE;
+ } else {
+ // Casting is safe here.
+ tmpIntVal = (int)tmpLongVal;
+ }
+ tmpLongVal -= tmpIntVal;
+
+ try {
+ xin.skipBytes(tmpIntVal);
+ } catch (Exception e) {
+ throw new IOException(e.toString());
+ }
+ } while (tmpLongVal > 0);
if (avail < n) {
return(avail);