com.nostra13.universalimageloader.utils
Class IoUtils

java.lang.Object
  extended by com.nostra13.universalimageloader.utils.IoUtils

public final class IoUtils
extends Object

Provides I/O operations

Since:
1.0.0
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)

Nested Class Summary
static interface IoUtils.CopyListener
          Listener and controller for copy process
 
Field Summary
static int CONTINUE_LOADING_PERCENTAGE
          75
static int DEFAULT_BUFFER_SIZE
          32768
static int DEFAULT_IMAGE_TOTAL_SIZE
          512000
 
Method Summary
static void closeSilently(Closeable closeable)
           
static boolean copyStream(InputStream is, OutputStream os, IoUtils.CopyListener listener)
          Copies stream, fires progress events by listener, can be interrupted by listener.
static boolean copyStream(InputStream is, OutputStream os, IoUtils.CopyListener listener, int bufferSize)
          Copies stream, fires progress events by listener, can be interrupted by listener.
static void readAndCloseStream(InputStream is)
          Reads all data from stream and close it silently
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUFFER_SIZE

public static final int DEFAULT_BUFFER_SIZE
32768

See Also:
Constant Field Values

DEFAULT_IMAGE_TOTAL_SIZE

public static final int DEFAULT_IMAGE_TOTAL_SIZE
512000

See Also:
Constant Field Values

CONTINUE_LOADING_PERCENTAGE

public static final int CONTINUE_LOADING_PERCENTAGE
75

See Also:
Constant Field Values
Method Detail

copyStream

public static boolean copyStream(InputStream is,
                                 OutputStream os,
                                 IoUtils.CopyListener listener)
                          throws IOException
Copies stream, fires progress events by listener, can be interrupted by listener. Uses buffer size = 32768 bytes.

Parameters:
is - Input stream
os - Output stream
listener - null-ok; Listener of copying progress and controller of copying interrupting
Returns:
true - if stream copied successfully; false - if copying was interrupted by listener
Throws:
IOException

copyStream

public static boolean copyStream(InputStream is,
                                 OutputStream os,
                                 IoUtils.CopyListener listener,
                                 int bufferSize)
                          throws IOException
Copies stream, fires progress events by listener, can be interrupted by listener.

Parameters:
is - Input stream
os - Output stream
listener - null-ok; Listener of copying progress and controller of copying interrupting
bufferSize - Buffer size for copying, also represents a step for firing progress listener callback, i.e. progress event will be fired after every copied bufferSize bytes
Returns:
true - if stream copied successfully; false - if copying was interrupted by listener
Throws:
IOException

readAndCloseStream

public static void readAndCloseStream(InputStream is)
Reads all data from stream and close it silently

Parameters:
is - Input stream

closeSilently

public static void closeSilently(Closeable closeable)


Copyright © 2011-2014. All Rights Reserved.