Package aQute.bnd.osgi
Class FileResource
java.lang.Object
aQute.bnd.osgi.FileResource
- All Implemented Interfaces:
Resource,Closeable,AutoCloseable
Resource for a file. This class implementation assumes the file does not
change underneath this object.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteBufferprivate static final ByteBufferprivate booleanprivate Stringprivate final Pathprivate final longprivate final longprivate static final int -
Constructor Summary
ConstructorsConstructorDescriptionTurn a resource into a file so that anything in the conversion is properly caughtFileResource(File file) FileResource(Path path) FileResource(Path path, BasicFileAttributes attrs) -
Method Summary
Modifier and TypeMethodDescriptionbuffer()voidclose()voiddeleteOnClose(boolean b) getExtra()UseResource.decodeExtra(String)to properly decode the ZIP extra field structured binary data from the returned String.getFile()longvoidUseResource.encodeExtra(byte[])to properly encode the ZIP extra field structured binary data into the specified String.longsize()toString()voidvoidwrite(OutputStream out) void
-
Field Details
-
THRESHOLD
private static final int THRESHOLD- See Also:
-
CLOSED
-
buffer
-
file
-
extra
-
deleteOnClose
private boolean deleteOnClose -
lastModified
private final long lastModified -
size
private final long size
-
-
Constructor Details
-
FileResource
- Throws:
IOException
-
FileResource
- Throws:
IOException
-
FileResource
FileResource(Path path, BasicFileAttributes attrs) throws IOException - Throws:
IOException
-
FileResource
Turn a resource into a file so that anything in the conversion is properly caught- Parameters:
r-- Throws:
Exception
-
-
Method Details
-
buffer
-
openInputStream
- Specified by:
openInputStreamin interfaceResource- Throws:
Exception
-
toString
-
write
-
write
-
write
-
lastModified
public long lastModified()- Specified by:
lastModifiedin interfaceResource
-
getExtra
Description copied from interface:ResourceUseResource.decodeExtra(String)to properly decode the ZIP extra field structured binary data from the returned String. -
setExtra
Description copied from interface:ResourceUseResource.encodeExtra(byte[])to properly encode the ZIP extra field structured binary data into the specified String. -
size
public long size() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
deleteOnClose
public void deleteOnClose(boolean b) -
getFile
-