Package com.jalios.io
Class NIOUtil
java.lang.Object
com.jalios.io.NIOUtil
This class provides a set of static methods which perform various
i/o operations based on the java.nio package.
- Since:
- jcms-5.0.0
- Author:
- Olivier Dedieu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclean(MappedByteBuffer buffer) static voidCopy f1 into f2 (mkdirs for f2).static voidCopy filename1 into filename2 (mkdirs for filename2)static longcountLines(File file) Counts the line of the given filestatic booleangoToLine(ByteBuffer buffer, long line) Move the position of the given ByteBuffer to the given line.
-
Constructor Details
-
NIOUtil
public NIOUtil()
-
-
Method Details
-
copyFile
Copy filename1 into filename2 (mkdirs for filename2)- Parameters:
filename1- the source filefilename2- the target file- Throws:
IOException- if an exception occurs- Since:
- jcms-5.0.5
-
copyFile
Copy f1 into f2 (mkdirs for f2). This method is about 25% faster than IOUtil.copyFile()- Parameters:
f1- the source filef2- the target file- Throws:
IOException- if an exception occurs- Since:
- jcms-5.0.5
-
goToLine
Move the position of the given ByteBuffer to the given line.- Parameters:
buffer- the buffer to move the position.line- the line to be reached- Returns:
- true if the line has been reached, false otherwite (line out of buffer size)
- Since:
- jcms-5.0.0
-
clean
- Throws:
Exception
-
countLines
Counts the line of the given file- Parameters:
file- the file- Returns:
- the line count.
- Throws:
IOException- if an exception occurs- Since:
- jcms-10.0.8
-