com.starteam.util
Class StreamUtils

java.lang.Object
  extended by com.starteam.util.StreamUtils

public final class StreamUtils
extends java.lang.Object


Nested Class Summary
static interface StreamUtils.Listener
           
 
Method Summary
static long bufferedTransfer(java.io.InputStream from, java.io.OutputStream to, int buffSize)
          Transfer data from an input to an output stream Buffer the transfer for faster processing throughput
static long bufferedTransfer(java.io.InputStream from, java.io.OutputStream to, int buffSize, MD5 aMD5)
          Transfer data from an input to an output stream Buffer the transfer for faster processing throughput
static long bufferedTransfer(java.io.InputStream from, java.io.OutputStream to, int buffSize, MD5 aMD5, StreamUtils.Listener listener)
          Transfer data from an input to an output stream Buffer the transfer for faster processing throughput
static java.io.File copy(java.io.File from, java.lang.String toDirectoryPath)
          create a file in the directory, with the same name as the file specified and copy it's content
static java.io.File copy(java.io.File from, java.lang.String toDirectoryPath, java.lang.String toFileName)
          create a file in the directory, with the specified to name and copy the content from the 'from' file
static long eatStream(java.io.InputStream from, int buffSize)
           
static long eatStream(java.io.InputStream from, int buffSize, MD5 aMD5)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

copy

public static java.io.File copy(java.io.File from,
                                java.lang.String toDirectoryPath)
                         throws java.io.IOException
create a file in the directory, with the same name as the file specified and copy it's content

Parameters:
from - File the File whose content needs to be copied
toDirectoryPath - the path to a directory into which the content must be copied this directory must already exist
Returns:
the newly created file
Throws:
java.io.IOException

copy

public static java.io.File copy(java.io.File from,
                                java.lang.String toDirectoryPath,
                                java.lang.String toFileName)
                         throws java.io.IOException
create a file in the directory, with the specified to name and copy the content from the 'from' file

Parameters:
from - File the File whose content needs to be copied
toDirectoryPath - the path to a directory into which the content must be copied this directory must already exist
toFileName - the name of the file to be created in the to directory
Returns:
the newly created file
Throws:
java.io.IOException

bufferedTransfer

public static long bufferedTransfer(java.io.InputStream from,
                                    java.io.OutputStream to,
                                    int buffSize)
                             throws java.io.IOException
Transfer data from an input to an output stream Buffer the transfer for faster processing throughput

Parameters:
from - InputStream the stream (remote server) to transfer from
to - OutputStream the stream (local file) to transfer to
buffSize - int the size of the buffer, or 65536 if not specified
Returns:
long the number of bytes transfered
Throws:
java.io.IOException

eatStream

public static long eatStream(java.io.InputStream from,
                             int buffSize)
                      throws java.io.IOException
Throws:
java.io.IOException

eatStream

public static long eatStream(java.io.InputStream from,
                             int buffSize,
                             MD5 aMD5)
                      throws java.io.IOException
Throws:
java.io.IOException

bufferedTransfer

public static long bufferedTransfer(java.io.InputStream from,
                                    java.io.OutputStream to,
                                    int buffSize,
                                    MD5 aMD5)
                             throws java.io.IOException
Transfer data from an input to an output stream Buffer the transfer for faster processing throughput

Parameters:
from - InputStream the stream (remote server) to transfer from
to - OutputStream the stream (local file) to transfer to
buffSize - int the size of the buffer, or 65536 if not specified
aMD5 - MD5 an md5 that is computed from the bytes being streamed
Returns:
long the number of bytes transfered
Throws:
java.io.IOException

bufferedTransfer

public static long bufferedTransfer(java.io.InputStream from,
                                    java.io.OutputStream to,
                                    int buffSize,
                                    MD5 aMD5,
                                    StreamUtils.Listener listener)
                             throws java.io.IOException
Transfer data from an input to an output stream Buffer the transfer for faster processing throughput

Parameters:
from - InputStream the stream (remote server) to transfer from
to - OutputStream the stream (local file) to transfer to
buffSize - int the size of the buffer, or 65536 if not specified
aMD5 - MD5 an md5 that is computed from the bytes being streamed
listener - StreamListener a listener which is notified per pass
Returns:
long the number of bytes transfered
Throws:
java.io.IOException


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.