java.lang.Object
com.arranger.jarl.util.IOUtil
- public class IOUtil
- extends java.lang.Object
IOUtil handles file saving operations
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_BUF_SIZE
protected static final int DEFAULT_BUF_SIZE
- See Also:
- Constant Field Values
TEMP_FILENAME_PREFIX
protected static final java.lang.String TEMP_FILENAME_PREFIX
- See Also:
- Constant Field Values
m_tempDirectory
protected static java.lang.String m_tempDirectory
IOUtil
public IOUtil()
save
public static void save(java.awt.Image image,
java.io.File file)
- Saves an image to a file
The image should be of the ColorModel: BufferedImage.TYPE_INT_RGB
And the file will be saved as a bmp
saveJPEG
public static void saveJPEG(java.awt.Image image,
java.io.File file)
- Writes a jpeg
load
public static java.awt.Image load(java.io.File file)
getInputStream
public static java.io.InputStream getInputStream(java.lang.String location)
throws java.io.IOException
getOutputStream
public static java.io.OutputStream getOutputStream(java.lang.String location)
throws java.io.IOException
getReader
public static java.io.Reader getReader(java.lang.String location)
throws java.io.IOException
getWriter
public static java.io.Writer getWriter(java.lang.String location)
throws java.io.IOException
loadProperties
public static java.util.Properties loadProperties(java.lang.String location)
throws java.io.IOException
toString
public static java.lang.String toString(java.lang.String location)
throws java.io.IOException
toByteArray
public static byte[] toByteArray(java.lang.String location)
throws java.io.IOException
- Get contents of file as a byte array
toCompressedByteArray
public static byte[] toCompressedByteArray(java.lang.String location)
throws java.io.IOException
- Like
toByteArray(java.lang.String) 55 , but uses toCompressedByteArray(java.lang.String) 55
toByteArray
public static byte[] toByteArray(java.io.InputStream inputStream)
throws java.io.IOException
toCompressedByteArray
public static byte[] toCompressedByteArray(java.io.InputStream inputStream)
throws java.io.IOException
decompress
public static void decompress(java.io.InputStream compressedStream,
java.io.OutputStream outputStream)
throws java.io.IOException
copyStream
public static int copyStream(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
throws java.io.IOException
- Copies all the bits from the inputStream to the ouputStream
getTLSByteArray
public static byte[] getTLSByteArray()
- Get the tls's byte array
getTempDirectory
public static java.lang.String getTempDirectory()
getTempFile
public static java.lang.String getTempFile(java.lang.String extension)
promptForInput
public static java.lang.String promptForInput(java.lang.String prompt)
- Helper function to promptForInput from
System.in