jBittorrentAPI
Class IOManager

java.lang.Object
  extended by jBittorrentAPI.IOManager

public class IOManager
extends java.lang.Object

Utility methods for I/O operations


Field Summary
(package private)  java.io.BufferedReader br
           
(package private)  java.io.BufferedWriter bw
           
private static LogManager lm
           
 
Constructor Summary
IOManager()
           
IOManager(java.lang.String filename)
           
 
Method Summary
static byte[] readBytesFromFile(java.io.File file)
          Read all available bytes from the given file
static byte[] readBytesFromStream(java.io.InputStream is)
          Read all bytes available in the stream
static java.lang.String readUserInput(java.lang.String question)
          Ask the user for an input
static boolean save(byte[] data, java.lang.String filename)
          Save the byte array into a file with the give filename
static void saveFromURL(java.io.InputStream is, java.lang.String filename)
          Save the bytes in the stream to the file in parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

br

java.io.BufferedReader br

bw

java.io.BufferedWriter bw

lm

private static LogManager lm
Constructor Detail

IOManager

public IOManager()

IOManager

public IOManager(java.lang.String filename)
Method Detail

readBytesFromFile

public static byte[] readBytesFromFile(java.io.File file)
Read all available bytes from the given file

Parameters:
file - File
Returns:
byte[]

readBytesFromStream

public static byte[] readBytesFromStream(java.io.InputStream is)
Read all bytes available in the stream

Parameters:
is - InputStream
Returns:
byte[]

readUserInput

public static java.lang.String readUserInput(java.lang.String question)
Ask the user for an input

Parameters:
question - The question that will be asked to the user
Returns:
String

save

public static boolean save(byte[] data,
                           java.lang.String filename)
Save the byte array into a file with the give filename

Parameters:
data - byte[]
filename - String
Returns:
boolean

saveFromURL

public static void saveFromURL(java.io.InputStream is,
                               java.lang.String filename)
                        throws java.io.IOException
Save the bytes in the stream to the file in parameter

Parameters:
is - InputStream
filename - String
Throws:
java.io.IOException