summaryrefslogtreecommitdiff
path: root/javaunohelper
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
commitfedd6eedf23831389c0025759e412e922b58c901 (patch)
tree6f655aa1d8c91b8f48cb7d9427c446e9780093a4 /javaunohelper
parent7b676ba8745d4e9de62436374654150c052468c5 (diff)
#97580# by B.Cameron : skip() is now int64 save
Diffstat (limited to 'javaunohelper')
-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 193235bac..1bb8d5493 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);