
public class OIOUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static long |
DAY |
static long |
HOUR |
static long |
MINUTE |
static long |
SECOND |
static String |
UTF8_BOM |
static long |
WEEK |
static long |
YEAR |
| Constructor and Description |
|---|
OIOUtils() |
| Modifier and Type | Method and Description |
|---|---|
static long |
copyStream(InputStream in,
OutputStream out,
long iMax) |
static Object |
encode(Object iValue) |
static boolean |
equals(byte[] buffer,
byte[] buffer2) |
static String |
getDatabaseNameFromPath(String iPath) |
static String |
getPathFromDatabaseName(String iPath) |
static String |
getRelativePathIfAny(String iDatabaseURL,
String iBasePath) |
static String |
getStringContent(Object iValue) |
static String |
getStringMaxLength(String iText,
int iMax) |
static String |
getStringMaxLength(String iText,
int iMax,
String iOther) |
static long |
getTimeAsMillisecs(Object iSize) |
static String |
getTimeAsString(long iTime) |
static Date |
getTodayWithTime(String iTime) |
static String |
getUnixFileName(String iFileName)
Returns the Unix file name format converting backslashes (\) to slasles (/)
|
static boolean |
isLong(String iText) |
static boolean |
isStringContent(Object iValue) |
static String |
java2unicode(String iInput) |
static void |
readByteBuffer(ByteBuffer buffer,
FileChannel channel)
|
static void |
readByteBuffer(ByteBuffer buffer,
FileChannel channel,
long position,
boolean throwOnEof)
|
static void |
readByteBuffers(ByteBuffer[] buffers,
FileChannel channel,
long bytesToRead,
boolean throwOnEof)
Reads from
FileChannel current position to array of ByteBuffers continues chunk of data till at least provided
limit of bytes will be written. |
static String |
readFileAsString(File iFile) |
static String |
readFileAsString(File iFile,
Charset iCharset) |
static void |
readFully(InputStream in,
byte[] b,
int off,
int len) |
static String |
readStreamAsString(InputStream iStream) |
static String |
readStreamAsString(InputStream iStream,
Charset iCharset) |
static String |
wrapStringContent(Object iValue,
char iStringDelimiter) |
static void |
writeByteBuffer(ByteBuffer buffer,
FileChannel channel,
long position)
|
static void |
writeByteBuffers(ByteBuffer[] buffers,
FileChannel channel,
long bytesToWrite)
Writes content of passed in buffers into
FileChannel since current channels position till at least
passed in limit of bytes. |
static void |
writeFile(File iFile,
String iContent) |
public static final long SECOND
public static final long MINUTE
public static final long HOUR
public static final long DAY
public static final long YEAR
public static final long WEEK
public static final String UTF8_BOM
public static long getTimeAsMillisecs(Object iSize)
public static String getTimeAsString(long iTime)
public static Date getTodayWithTime(String iTime) throws ParseException
ParseExceptionpublic static String readFileAsString(File iFile) throws IOException
IOExceptionpublic static String readFileAsString(File iFile, Charset iCharset) throws IOException
IOExceptionpublic static String readStreamAsString(InputStream iStream) throws IOException
IOExceptionpublic static String readStreamAsString(InputStream iStream, Charset iCharset) throws IOException
IOExceptionpublic static void writeFile(File iFile, String iContent) throws IOException
IOExceptionpublic static long copyStream(InputStream in, OutputStream out, long iMax) throws IOException
IOExceptionpublic static String getUnixFileName(String iFileName)
public static String getRelativePathIfAny(String iDatabaseURL, String iBasePath)
public static boolean isStringContent(Object iValue)
public static boolean equals(byte[] buffer,
byte[] buffer2)
public static boolean isLong(String iText)
public static void readFully(InputStream in, byte[] b, int off, int len) throws IOException
IOExceptionpublic static void readByteBuffer(ByteBuffer buffer, FileChannel channel, long position, boolean throwOnEof) throws IOException
FileChannel to ByteBuffer starting from passed in position in FileChannel.
Data will be read to ByteBuffer starting from current position till buffer limit.
This method is thread safe in sense that several threads can read from the same FileChannel.
throwOnEof - If parameter set to true then EOF exception will be thrown if end of file will be reached
otherwise buffer will be filled with 0 bytes.IOExceptionpublic static void readByteBuffer(ByteBuffer buffer, FileChannel channel) throws IOException
FileChannel to ByteBuffer starting from current position in FileChannel.
Data will be read to ByteBuffer since the start of the buffer till buffer limit.
This method is not thread safe, several threads can not read from the same channel.
IOExceptionpublic static void writeByteBuffer(ByteBuffer buffer, FileChannel channel, long position) throws IOException
ByteBuffer to FileChannel starting from passed in FileChannel position.
Data will be written since the start of the buffer till buffer limit.
This method is thread safe in the sense that several threads can write to single FileChannel.
IOExceptionpublic static void writeByteBuffers(ByteBuffer[] buffers, FileChannel channel, long bytesToWrite) throws IOException
FileChannel since current channels position till at least
passed in limit of bytes.
All buffers content will be written starting from their zero position.
This method is not thread safe, many threads can not write into single channel.
bytesToWrite - Minimum amount of bytes which should be written to channelIOExceptionpublic static void readByteBuffers(ByteBuffer[] buffers, FileChannel channel, long bytesToRead, boolean throwOnEof) throws IOException
FileChannel current position to array of ByteBuffers continues chunk of data till at least provided
limit of bytes will be written.
Data will be loaded into buffers since zero position.
This methods is not thread safe, several threads can not read from the same channel.
bytesToRead - Minimum amount of bytes which should be read from channel.throwOnEof - if flag is set to true EOF exception will be thrown, otherwise end of buffers will be filled by
zeros.IOExceptionCopyright © 2009–2025 OrientDB. All rights reserved.