Package aQute.bnd.osgi
Class FileResource
- java.lang.Object
-
- aQute.bnd.osgi.FileResource
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBufferbufferprivate static java.nio.ByteBufferCLOSEDprivate booleandeleteOnCloseprivate java.lang.Stringextraprivate java.nio.file.Pathfileprivate longlastModifiedprivate longsizeprivate static intTHRESHOLD
-
Constructor Summary
Constructors Constructor Description FileResource(Resource r)Turn a resource into a file so that anything in the conversion is properly caughtFileResource(java.io.File file)FileResource(java.nio.file.Path path)FileResource(java.nio.file.Path path, java.nio.file.attribute.BasicFileAttributes attrs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBufferbuffer()voidclose()voiddeleteOnClose(boolean b)java.lang.StringgetExtra()java.io.FilegetFile()longlastModified()java.io.InputStreamopenInputStream()voidsetExtra(java.lang.String extra)longsize()java.lang.StringtoString()voidwrite(java.io.OutputStream out)
-
-
-
Field Detail
-
THRESHOLD
private static final int THRESHOLD
- See Also:
- Constant Field Values
-
CLOSED
private static final java.nio.ByteBuffer CLOSED
-
buffer
private java.nio.ByteBuffer buffer
-
file
private final java.nio.file.Path file
-
extra
private java.lang.String extra
-
deleteOnClose
private boolean deleteOnClose
-
lastModified
private final long lastModified
-
size
private final long size
-
-
Constructor Detail
-
FileResource
public FileResource(java.io.File file) throws java.io.IOException- Throws:
java.io.IOException
-
FileResource
public FileResource(java.nio.file.Path path) throws java.io.IOException- Throws:
java.io.IOException
-
FileResource
FileResource(java.nio.file.Path path, java.nio.file.attribute.BasicFileAttributes attrs) throws java.io.IOException- Throws:
java.io.IOException
-
FileResource
public FileResource(Resource r) throws java.lang.Exception
Turn a resource into a file so that anything in the conversion is properly caught- Parameters:
r-- Throws:
java.lang.Exception
-
-
Method Detail
-
buffer
public java.nio.ByteBuffer buffer() throws java.lang.Exception
-
openInputStream
public java.io.InputStream openInputStream() throws java.lang.Exception- Specified by:
openInputStreamin interfaceResource- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
write
public void write(java.io.OutputStream out) throws java.lang.Exception
-
lastModified
public long lastModified()
- Specified by:
lastModifiedin interfaceResource
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
deleteOnClose
public void deleteOnClose(boolean b)
-
getFile
public java.io.File getFile()
-
-