org.opcfoundation.ua.utils
Class StreamUtil

java.lang.Object
  extended by org.opcfoundation.ua.utils.StreamUtil

public class StreamUtil
extends Object

StreamUtil class.

Author:
Toni Kalajainen (toni.kalajainen@vtt.fi)

Constructor Summary
StreamUtil()
           
 
Method Summary
static void copyStream(InputStream is, OutputStream out)
          copyStream.
static void read(InputStream is, ByteBuffer buf, int bytes)
          read.
static byte[] readFully(InputStream is)
          Reads entire resource from an input stream
static void readFully(InputStream is, byte[] b)
          readFully.
static void readFully(InputStream is, byte[] b, int off, int len)
          readFully.
static void readFully(InputStream is, ByteBuffer buf)
          readFully.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamUtil

public StreamUtil()
Method Detail

readFully

public static byte[] readFully(InputStream is)
                        throws IOException
Reads entire resource from an input stream

Parameters:
is - a InputStream object.
Returns:
resource
Throws:
IOException - if any.

copyStream

public static void copyStream(InputStream is,
                              OutputStream out)
                       throws IOException

copyStream.

Parameters:
is - a InputStream object.
out - a OutputStream object.
Throws:
IOException - if any.

read

public static void read(InputStream is,
                        ByteBuffer buf,
                        int bytes)
                 throws IOException

read.

Parameters:
is - a InputStream object.
buf - a ByteBuffer object.
bytes - a int.
Throws:
IOException - if any.

readFully

public static void readFully(InputStream is,
                             ByteBuffer buf)
                      throws IOException

readFully.

Parameters:
is - a InputStream object.
buf - a ByteBuffer object.
Throws:
IOException - if any.

readFully

public static void readFully(InputStream is,
                             byte[] b)
                      throws IOException

readFully.

Parameters:
is - a InputStream object.
b - an array of byte.
Throws:
IOException - if any.

readFully

public static void readFully(InputStream is,
                             byte[] b,
                             int off,
                             int len)
                      throws IOException

readFully.

Parameters:
is - a InputStream object.
b - an array of byte.
off - a int.
len - a int.
Throws:
IOException - if any.


Copyright © 2018. All rights reserved.