Package org.apache.maven.buildcache.hash
Class CloseableBuffer
- java.lang.Object
-
- org.apache.maven.buildcache.hash.CloseableBuffer
-
- All Implemented Interfaces:
AutoCloseable
public class CloseableBuffer extends Object implements AutoCloseable
CloseableBuffer https://stackoverflow.com/a/54046774
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static CloseableBufferdirectBuffer(int capacity)ByteBuffergetBuffer()Do not use buffer after closestatic CloseableBuffermappedBuffer(FileChannel channel, FileChannel.MapMode mode)
-
-
-
Method Detail
-
directBuffer
public static CloseableBuffer directBuffer(int capacity)
-
mappedBuffer
public static CloseableBuffer mappedBuffer(FileChannel channel, FileChannel.MapMode mode) throws IOException
- Throws:
IOException
-
getBuffer
public ByteBuffer getBuffer()
Do not use buffer after close
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-