Skip to content

Commit bd19ff6

Browse files
committed
[Java] Rather than call truncate pass in TRUNCATE_EXISTING when generating a IR. Issue #682.
1 parent 7c52535 commit bd19ff6

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

sbe-tool/src/main/java/uk/co/real_logic/sbe/ir/IrEncoder.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
import java.nio.file.Paths;
3131
import java.util.List;
3232

33-
import static java.nio.file.StandardOpenOption.CREATE;
34-
import static java.nio.file.StandardOpenOption.READ;
35-
import static java.nio.file.StandardOpenOption.WRITE;
33+
import static java.nio.file.StandardOpenOption.*;
3634
import static uk.co.real_logic.sbe.ir.IrUtil.*;
3735
import static uk.co.real_logic.sbe.ir.generated.FrameCodecEncoder.namespaceNameCharacterEncoding;
3836
import static uk.co.real_logic.sbe.ir.generated.FrameCodecEncoder.packageNameCharacterEncoding;
@@ -67,8 +65,7 @@ public IrEncoder(final String fileName, final Ir ir)
6765
{
6866
try
6967
{
70-
channel = FileChannel.open(Paths.get(fileName), READ, WRITE, CREATE);
71-
channel.truncate(0);
68+
channel = FileChannel.open(Paths.get(fileName), READ, WRITE, CREATE, TRUNCATE_EXISTING);
7269
resultBuffer = null;
7370
buffer = ByteBuffer.allocateDirect(CAPACITY);
7471
directBuffer = new UnsafeBuffer(buffer);

0 commit comments

Comments
 (0)