diff options
-rw-r--r-- | ridljar/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/ridljar/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java b/ridljar/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java index 3d60e5a1181a..a81bb85b1c57 100644 --- a/ridljar/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java +++ b/ridljar/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -15,6 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ + package com.sun.star.lib.uno.adapter; import java.io.IOException; @@ -76,23 +78,21 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream { com.sun.star.io.IOException { try { - long bytesRead; - if (len >iIn.available()) { - bytesRead = iIn.read(b[0], 0, iIn.available()); - } - else{ - bytesRead = iIn.read(b[0], 0, len); - } + long bytesRead; + if (len >iIn.available()) { + bytesRead = iIn.read(b[0], 0, iIn.available()); + } + else{ + bytesRead = iIn.read(b[0], 0, len); + } + // Casting bytesRead to an int is okay, since the user can // only pass in an integer length to read, so the bytesRead // must <= len. - if (bytesRead <= 0) { return 0; - } - return ((int)bytesRead); - - + } + return ((int)bytesRead); } catch (IOException e) { throw new com.sun.star.io.IOException("reader error", e); } @@ -102,23 +102,21 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream { com.sun.star.io.IOException { try { - long bytesRead; - if (len >iIn.available()) { - bytesRead = iIn.read(b[0], 0, iIn.available()); - } - else{ - bytesRead = iIn.read(b[0], 0, len); - } + long bytesRead; + if (len >iIn.available()) { + bytesRead = iIn.read(b[0], 0, iIn.available()); + } + else{ + bytesRead = iIn.read(b[0], 0, len); + } + // Casting bytesRead to an int is okay, since the user can // only pass in an integer length to read, so the bytesRead // must <= len. - if (bytesRead <= 0) { return 0; - } - return ((int)bytesRead); - - + } + return ((int)bytesRead); } catch (IOException e) { throw new com.sun.star.io.IOException("reader error", e); } @@ -143,3 +141,4 @@ public final class InputStreamToXInputStreamAdapter implements XInputStream { } } +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |