Skip to content

Commit a6c475f

Browse files
committed
squash: Account for isSeekable when creating void block.
1 parent 1990174 commit a6c475f

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/main/java/org/ebml/matroska/MatroskaFileTags.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ public long writeTags(final DataWriter ioDW, boolean checkBlockSize)
4141

4242
long len = tagsElem.writeElement(ioDW);
4343

44-
if (BLOCK_SIZE > tagsElem.getTotalSize())
44+
if (BLOCK_SIZE > tagsElem.getTotalSize() && ioDW.isSeekable())
4545
{
4646
new VoidElement(BLOCK_SIZE - tagsElem.getTotalSize()).writeElement(ioDW);
4747
return BLOCK_SIZE;
4848
}
49-
else
50-
{
51-
return len;
52-
}
49+
50+
return len;
5351
}
5452

5553
public long update(final DataWriter ioDW, boolean checkBlockSize)

src/main/java/org/ebml/matroska/MatroskaFileTracks.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ public long writeTracks(final DataWriter ioDW, boolean checkBlockSize)
4141

4242
long size = tracksElem.writeElement(ioDW);
4343

44-
if (BLOCK_SIZE > tracksElem.getTotalSize())
44+
if (BLOCK_SIZE > tracksElem.getTotalSize() && ioDW.isSeekable())
4545
{
4646
new VoidElement(BLOCK_SIZE - tracksElem.getTotalSize()).writeElement(ioDW);
4747
return BLOCK_SIZE;
4848
}
49-
else
50-
{
51-
return size;
52-
}
49+
50+
return size;
5351
}
5452

5553
public long update(final DataWriter ioDW, boolean checkBlockSize)

0 commit comments

Comments
 (0)