private void writeHeader(LogSegment segment, byte[] buf) throws IOException {
    FileChannel channel = segment.getView().getSecond();
    ByteBuffer buffer = ByteBuffer.wrap(buf);
    while (buffer.hasRemaining()) {
      channel.write(buffer, 0);
    }
  }
Tests for bad construction cases of {@link LogSegment}.
@throws IOException
ambry-store/src/test/java/com/github/ambry/store/LogSegmentTest.java