File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
btrfs-io/src/main/java/nl/gmta/btrfs/io
btrfs-structures/src/main/java/nl/gmta/btrfs/structure/stream Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 1818import nl .gmta .btrfs .structure .stream .BtrfsTimespec ;
1919import nl .gmta .btrfs .structure .stream .BtrfsTruncateCommand ;
2020import nl .gmta .btrfs .structure .stream .BtrfsUTimesCommand ;
21+ import nl .gmta .btrfs .structure .stream .BtrfsUnlinkCommand ;
2122import nl .gmta .btrfs .structure .stream .BtrfsWriteCommand ;
2223
2324public class BtrfsStreamReader implements AutoCloseable {
@@ -109,6 +110,9 @@ private BtrfsStreamCommand readCommand() throws IOException {
109110 case TRUNCATE :
110111 command = this .readTruncateCommand (header );
111112 break ;
113+ case UNLINK :
114+ command = this .readUnlinkCommand (header );
115+ break ;
112116 case UTIMES :
113117 command = this .readUTimesCommand (header );
114118 break ;
@@ -185,6 +189,12 @@ private BtrfsTruncateCommand readTruncateCommand(BtrfsStreamCommandHeader header
185189 return new BtrfsTruncateCommand (header , path , size );
186190 }
187191
192+ private BtrfsUnlinkCommand readUnlinkCommand (BtrfsStreamCommandHeader header ) throws IOException {
193+ String path = (String ) this .readAttribute (BtrfsAttributeType .PATH );
194+
195+ return new BtrfsUnlinkCommand (header , path );
196+ }
197+
188198 private BtrfsUTimesCommand readUTimesCommand (BtrfsStreamCommandHeader header ) throws IOException {
189199 String path = (String ) this .readAttribute (BtrfsAttributeType .PATH );
190200 BtrfsTimespec atime = (BtrfsTimespec ) this .readAttribute (BtrfsAttributeType .ATIME );
Original file line number Diff line number Diff line change 1+ package nl .gmta .btrfs .structure .stream ;
2+
3+ public class BtrfsUnlinkCommand extends BtrfsStreamCommand {
4+ private final String path ;
5+
6+ public BtrfsUnlinkCommand (BtrfsStreamCommandHeader header , String path ) {
7+ super (header );
8+
9+ this .path = path ;
10+ }
11+
12+ public String getPath () {
13+ return this .path ;
14+ }
15+
16+ @ Override
17+ public String toString () {
18+ return String .format (
19+ "%s{header=%s path='%s'}" ,
20+ this .getClass ().getSimpleName (),
21+ this .header ,
22+ this .path
23+ );
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments