|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.quadrique.jbuildingblocks.core.io.stream.JbbStream
public class JbbStream
This class provides goodies to manipulate streams (files, String, byte arrays...)
| Method Summary | |
|---|---|
long |
copyByteArrayToFile(byte[] bytes,
String fileName)
Copy the given byte array to a file |
long |
copyByteArrayToOutputStream(byte[] bytes,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
Copy the given byte array to the given output stream |
byte[] |
copyFileToByteArray(File file)
Copy the given file in a byte array |
byte[] |
copyFileToByteArray(String fileName)
Copy the given file in a byte array |
long |
copyFileToFile(File sourceFile,
File destFile)
Copy the given input file to the given output file |
long |
copyFileToOutputStream(String fileName,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
Copy the content of the given file in the given output stream Both input and output streams are synchronized for concurrent access |
String |
copyFileToString(String fileName)
Copy the content of the given file in a string, translating bytes into characters according to the platform's default character encoding. |
String |
copyFileToString(String fileName,
String characterEncoding)
Copy the content of the given file in a string, translating bytes into characters according to the given character encoding (e.g. |
byte[] |
copyInputStreamToByteArray(InputStream inputStream,
boolean closeInputStream)
|
long |
copyInputStreamToFile(InputStream inputStream,
File file,
boolean closeInputStream)
|
long |
copyStreamToStream(InputStream inputStream,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeInputStream,
boolean closeOutputStream)
Both input and output streams are synchronized for concurrent access |
byte[] |
copyStringToByteArray(String string)
Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array. |
byte[] |
copyStringToByteArray(String string,
String charsetName)
Encodes this String into a sequence of bytes using the named charset ((e.g. |
long |
copyStringToFile(String string,
String destinationFileName)
Encodes this String into a sequence of bytes using the platform's default character set, storing the result into the given file name Both input and output streams are synchronized for concurrent access |
long |
copyStringToFile(String string,
String charsetName,
String destinationFileName)
Encodes this String into a sequence of bytes using the named charset ((e.g. |
long |
copyStringToOutputStream(String string,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
Encodes this String into a sequence of bytes using the platform's default character set, storing the result into the given output stream Both input and output streams are synchronized for concurrent access |
long |
copyStringToOutputStream(String string,
String charsetName,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
Encodes this String into a sequence of bytes using the named charset ((e.g. |
static JbbStream |
newInstance()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static JbbStream newInstance()
public long copyStreamToStream(InputStream inputStream,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeInputStream,
boolean closeOutputStream)
throws Exception
inputStream - outputStream - useBufferedOutputStream - true to use a BufferedOutputStream for the actual copy, false otherwisecloseInputStream - true to close the input stream once the copy has been performedcloseOutputStream - true to close the output stream once the copy has been performed
Exception
public long copyByteArrayToOutputStream(byte[] bytes,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
throws Exception
bytes - outputStream - useBufferedOutputStream - true to use a BufferedOutputStream for the actual copy, false otherwisecloseOutputStream - true to close the output stream once the copy has been performed
Exception
public long copyByteArrayToFile(byte[] bytes,
String fileName)
throws Exception
bytes - fileName -
Exception
public long copyFileToOutputStream(String fileName,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
throws Exception
fileName - outputStream - useBufferedOutputStream - true to use a BufferedOutputStream for the actual copy, false otherwisecloseOutputStream - true to close the output stream once the copy has been performed
Exception
public long copyFileToFile(File sourceFile,
File destFile)
throws Exception
sourceFile - destFile -
Exception
public String copyFileToString(String fileName)
throws Exception
fileName -
Exception
public String copyFileToString(String fileName,
String characterEncoding)
throws Exception
fileName - characterEncoding -
Exception
public byte[] copyFileToByteArray(File file)
throws Exception
file -
Exception
public byte[] copyFileToByteArray(String fileName)
throws Exception
fileName -
Exception
public byte[] copyStringToByteArray(String string)
throws Exception
string -
Exception
public byte[] copyStringToByteArray(String string,
String charsetName)
throws Exception
string - charsetName -
Exception
public long copyStringToOutputStream(String string,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
throws Exception
string - outputStream - useBufferedOutputStream - true to use a BufferedOutputStream for the actual copy, false otherwisecloseOutputStream - true to close the output stream once the copy has been performed
Exception
public long copyStringToOutputStream(String string,
String charsetName,
OutputStream outputStream,
boolean useBufferedOutputStream,
boolean closeOutputStream)
throws Exception
string - charsetName - the name of the charsetoutputStream - useBufferedOutputStream - true to use a BufferedOutputStream for the actual copy, false otherwisecloseOutputStream - true to close the output stream once the copy has been performed
Exception
public long copyStringToFile(String string,
String destinationFileName)
throws Exception
string - the string to save in the destination filedestinationFileName - the destination file name
Exception
public long copyStringToFile(String string,
String charsetName,
String destinationFileName)
throws Exception
string - the string to save in the destination filecharsetName - the name of the charsetdestinationFileName - the destination file name
Exception
public long copyInputStreamToFile(InputStream inputStream,
File file,
boolean closeInputStream)
throws Exception
inputStream - file - closeInputStream -
Exception
public byte[] copyInputStreamToByteArray(InputStream inputStream,
boolean closeInputStream)
throws Exception
inputStream - closeInputStream -
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||