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 ByteBuffer
private static final ByteBuffer
private boolean
private String
private final Path
private final long
private final long
private 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()
void
close()
void
deleteOnClose
(boolean b) getExtra()
UseResource.decodeExtra(String)
to properly decode the ZIP extra field structured binary data from the returned String.getFile()
long
void
UseResource.encodeExtra(byte[])
to properly encode the ZIP extra field structured binary data into the specified String.long
size()
toString()
void
void
write
(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:
openInputStream
in interfaceResource
- Throws:
Exception
-
toString
-
write
-
write
-
write
-
lastModified
public long lastModified()- Specified by:
lastModified
in interfaceResource
-
getExtra
Description copied from interface:Resource
UseResource.decodeExtra(String)
to properly decode the ZIP extra field structured binary data from the returned String. -
setExtra
Description copied from interface:Resource
UseResource.encodeExtra(byte[])
to properly encode the ZIP extra field structured binary data into the specified String. -
size
public long size() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
deleteOnClose
public void deleteOnClose(boolean b) -
getFile
-