Skip to content

Conversation

houzhizhen
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Feb 25, 2021

Codecov Report

Merging #15 (2104b2c) into master (bb462d3) will increase coverage by 2.47%.
The diff coverage is 94.39%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #15 +/- ## ============================================ + Coverage 77.83% 80.31% +2.47%  - Complexity 631 746 +115  ============================================ Files 68 72 +4 Lines 2148 2474 +326 Branches 176 216 +40 ============================================ + Hits 1672 1987 +315  - Misses 370 371 +1  - Partials 106 116 +10 
Impacted Files Coverage Δ Complexity Δ
...aidu/hugegraph/computer/core/common/Constants.java 50.00% <ø> (ø) 1.00 <0.00> (ø)
...hugegraph/computer/core/io/GraphOutputFactory.java 33.33% <ø> (ø) 2.00 <0.00> (ø)
...ph/computer/core/io/OptimizedStreamGraphInput.java 100.00% <ø> (ø) 3.00 <0.00> (ø)
...h/computer/core/io/OptimizedStreamGraphOutput.java 100.00% <ø> (ø) 3.00 <0.00> (ø)
...egraph/computer/core/io/UnsafeByteArrayOutput.java 97.05% <85.71%> (+6.76%) 33.00 <2.00> (+3.00)
...gegraph/computer/core/io/BufferedStreamOutput.java 89.18% <89.18%> (ø) 24.00 <24.00> (?)
.../hugegraph/computer/core/io/BufferedFileInput.java 93.65% <93.65%> (ø) 20.00 <20.00> (?)
...hugegraph/computer/core/io/BufferedFileOutput.java 93.75% <93.75%> (ø) 22.00 <22.00> (?)
...gegraph/computer/core/io/UnsafeByteArrayInput.java 97.05% <95.45%> (-0.51%) 34.00 <10.00> (+8.00) ⬇️
...ugegraph/computer/core/io/BufferedStreamInput.java 98.71% <98.71%> (ø) 25.00 <25.00> (?)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb462d3...2104b2c. Read the comment docs.

int readLen = (int) Math.min(bufferSize, this.fileLength);
this.file.readFully(this.buffer(), 0, readLen);
this.fileOffset = readLen;
super.limit(readLen);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call fillBuffer

int remaining = this.remaining();
if (remaining > 0) {
System.arraycopy(this.buffer, this.position,
this.buffer,0, remaining);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a space before 0

* Cut the content from 0 to position and copy the content from position
* to the end to 0.
*/
protected void cutReadBuffer() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shiftBuffer() is ok

super.write(b, off, len);
return;
}
this.writeBuffer();
Copy link
Contributor

@javeme javeme Feb 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to flushBuffer()

int remaining = super.remaining();
super.readFully(b, off, remaining);
this.file.readFully(b, off + remaining, len - remaining);
this.fileOffset += len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a method fillBuffer()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part of the data needed is in buffer, the other part is in file, and the length of data is beyond the buffer size, so read from two places.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add length parameter to fillBuffer()

import com.baidu.hugegraph.util.E;

public class BufferedFileDataInput extends UnsafeByteArrayInput
implements RandomAccessInput {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't implement RandomAccessInput, since UnsafeByteArrayInput implements RandomAccessInput

E.checkArgument(bufferSize >= 8,
"The parameter bufferSize must be >= 8");
this.file = file;
this.fileLength = file.length();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this field

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileLength is used several time, we call file.length() every time?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems the fileLength is not used everywhere after added fillBuffer() method

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is used in seek(long position). The position may be far from the current position

private final RandomAccessFile file;
private final long fileLength;

public BufferedFileDataInput(File file) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add RandomAccessInputStream class to support InputStream as parameter

import com.baidu.hugegraph.computer.core.common.exception.ComputerException;
import com.baidu.hugegraph.util.E;

public class BufferedFileDataInput extends UnsafeByteArrayInput
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to BufferedFileInput

int remaining = super.remaining();
super.readFully(b, off, remaining);
this.file.readFully(b, off + remaining, len - remaining);
this.fileOffset += len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add length parameter to fillBuffer()

super.seek(0L);
this.file.readFully(this.buffer(), 0, readLen);
super.limit(readLen);
this.fileOffset = position + readLen;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also call fillBuffer()

}

@Override
public void readFully(byte[] b, int off, int len) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should also deal with buffer overflow for other read* methods like readLong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need, since the buffer size must be >=8, and if there is no enough data in the buffer, the overwritten require method will fillBuffer again.

long bufferAvailable = this.bufferSize - position;
if (bufferAvailable >= size) {
super.require(size);
long available = this.bufferSize - position;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

long available = this.bufferSize - super.position();

}

public BufferedInputStream(InputStream in, int bufferSize)
throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align


public class BufferedInputStream extends UnsafeByteArrayInput {

private long inOffset;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inputOffset

if (this.remaining() >= size) {
return;
}
shiftAndFillBuffer();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this

}

@Test
public void testInt() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testWriteInt

output.writeInt(Integer.MAX_VALUE);
output.writeInt(Integer.MIN_VALUE);
}
LOG.info("file.length:{}", file.length());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it

}
}

private File createTempFile() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set static

(this.osOffset + this.bufferSize) + ")");
"of range [" + this.outputOffset + ", " +
(this.outputOffset + this.bufferSize) +
")");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to use String.format()

}

private BufferedFileOutput createOutput(File file)
private static BufferedFileOutput createOutput(File file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align

Assert.assertThrows(IOException.class, () -> {
input.seek(size * 4 + 1);
}, e -> {
Assert.assertContains("Can't seek at position ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space

Assert.assertThrows(IOException.class, () -> {
output.seek(output.position() - BUFFER_SIZE - 2);
}, e -> {
Assert.assertContains("out of range ", e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

}

@Test
public void testLargeByteArray() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writeXX


byte[] arrayRead = new byte[arraySize];
try (DataInputStream dis = new DataInputStream(
new FileInputStream(file))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to align with new DataInputStream

output.writeInt(i);
}
output.writeInt(200, 1);
// Previous buffer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test 5 kind of position: buffer_start ~ buffer_end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The five kind of position include start point of current buffer, middle point of current buffer, end point of current buffer, before the current buffer, and current buffer, and the last two kind of position throws exception.

for (int i = 0; i < size; i++) {
output.seek(i * 4);
output.writeInt(i);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line

}

@Test
public void testSeekMoreThanBuffer() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overflow and underflow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case is deleted, and overflow and underflow test is in testSeekOutRange

Copy link
Contributor

@javeme javeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please addressed all the comments

throw new IOException("The position is beyond the buffer");
throw new IOException(String.format(
"The seek position %s is before the start position of " +
"buffer %s",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The seek position %s underflows the start position %s of the buffer

/*
* The reason to seek to the position beyond the current buffer is
* the user may need to skip the data unread and known the position of
* the data needed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for seeking beyond the current buffer location is that the user may need to skip unread data and know the offset of the required data.

output.seek((size - 2) * 4);
output.writeInt(Integer.MAX_VALUE);
output.writeInt(Integer.MIN_VALUE);
// The position is before the buffer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update all the "before" to "underflow"

public static final int UINT16_MAX = 0xffff;
public static final long UINT32_MAX = 0xffffffffL;

public static final int DEFAULT_BUFFER_SIZE = 8192;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not addressed comments: Bytes.KB * 8

"The seek position %s is before the start position of " +
"buffer %s",
position, this.inputOffset - super.limit()));
"The seek position %s is underflow the start position " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is underflow => underflows

public long skip(long n) throws IOException {
E.checkArgument(n >= 0, "The parameter n must be >=0, but got %s", n);
public long skip(long bytesToSkip) throws IOException {
E.checkArgument(bytesToSkip >= 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0L

"The parameter bytesToSkip must be <= " +
"Integer.MAX_VALUE");
public long skip(long bytesToSkip) throws IOException {
E.checkArgument(bytesToSkip >= 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

output.writeByte(1);
Assert.assertThrows(IllegalArgumentException.class, () -> {
output.skip(-1);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert message

Assert.assertEquals((byte) 1, input.readByte());
Assert.assertThrows(IllegalArgumentException.class, () -> {
input.skip(-1);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert message

private void fillBuffer() throws IOException {
long fileLength = this.file.length();
int readLen = Math.min(this.bufferSize - super.limit(),
int readLen = Math.min(this.bufferSize - this.limit(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use this.remaining() instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read fill the buffer after the limit, remaining is the buffer before the limit.
public int remaining() {
return this.limit - this.position;
}

if (position < this.fileOffset &&
position >= this.fileOffset - this.bufferSize) {
super.seek(this.bufferSize - (this.fileOffset - position));
super.seek(this.limit() - (this.fileOffset - position));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.limit() and this.bufferSize are the same value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the same value. The last buffer may not equals bufferSize.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bufferStart = this.fileOffset - this.limit
put position >= bufferStart before position < this.fileOffset
super.seek(position - bufferStart)

output.skip(-1);
}, e -> {
e.getMessage().contains("The parameter bytesToSkip must " +
"be >=0");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect space ">=0"

if (position < this.fileOffset &&
position >= this.fileOffset - this.bufferSize) {
super.seek(this.bufferSize - (this.fileOffset - position));
super.seek(this.limit() - (this.fileOffset - position));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

int expectLen = Math.min(skipLen, this.bufferSize);
int readLen = this.input.read(buffer, 0, expectLen);
if (readLen == -1) {
throw new IOException("Reach the end of input stream");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve message

}
this.shiftAndFillBuffer();
if (size > this.limit()) {
throw new IOException("Can't read " + size + " bytes");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve message, like "read %size bytes from position overflows buffer %this.limit()"

private void require(int size) {
@Override
public void close() throws IOException {
// Do nothing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass


protected void limit(int limit) {
E.checkArgument(limit <= this.buffer.length,
"The limit must be >= buffer.length: {}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buffer length %s

Assert.assertContains("is out of range",
e.getMessage());
});
Assert.assertThrows(IOException.class, () -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behind buffer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overflows the buffer is better.


byte[] arrayRead = new byte[10];
try (DataInputStream dis = new DataInputStream(
new FileInputStream(file))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align

@Override
public void close() throws IOException {
// Do nothing
// Pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lower case pass

@Override
public void close() throws IOException {
// Do nothing
// Pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

if (size > this.limit()) {
throw new IOException("Can't read " + size + " bytes");
throw new IOException(String.format(
"Read %s bytes from position overflows buffer %s",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

position %s

"The position %s is out of range [%s, %s]",
position, this.outputOffset,
this.position() - 4));
"Write int from position %s overflows the write " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write int to position

} else {
throw new IOException(String.format(
"Write int from position %s overflows the write " +
"Write int to position %s overflows the write " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.position() - 4
use INT_SIZE

private long fileOffset;

public BufferedFileInput(File file) throws IOException {
this(new RandomAccessFile(file, "r"), Constants.DEFAULT_BUFFER_SIZE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const var "r"

if (position < this.fileOffset &&
position >= this.fileOffset - this.bufferSize) {
super.seek(this.bufferSize - (this.fileOffset - position));
super.seek(this.limit() - (this.fileOffset - position));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bufferStart = this.fileOffset - this.limit
put position >= bufferStart before position < this.fileOffset
super.seek(position - bufferStart)

@Override
public void seek(long position) throws IOException {
if (position < this.fileOffset &&
position >= this.fileOffset - this.bufferSize) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-this.limit

if (this.bufferSize >= size) {
this.shiftAndFillBuffer();
} else {
throw new ComputerException("Should not reach here");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: Should not reach here
throw XxException

this.fileOffset = position;
this.fillBuffer();
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line

return;
}
this.flushBuffer();
assert size <= this.bufferAvailable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw

private long fileOffset;

public BufferedFileOutput(File file) throws FileNotFoundException {
this(new RandomAccessFile(file, "rw"), Constants.DEFAULT_BUFFER_SIZE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const var

return;
}
this.flushBuffer();
if (len <= this.bufferSize) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.bufferCapacity

E.checkArgument(bufferSize >= 8,
"The parameter bufferSize must be >= 8");
this.file = file;
this.bufferSize = bufferSize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bufferCapacity

javeme
javeme previously approved these changes Mar 10, 2021
coderzc
coderzc previously approved these changes Mar 10, 2021
/*
* The buffer capacity must be >= 8, read primitive data like int,
* long, float, double can be read from buffer. Only read bytes may
* exceed the limit, and read bytes using readFully is overrode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

override

* The buffer capacity must be >= 8, write primitive data like int,
* long, float, double can be write to buffer after flush buffer.
* Only write bytes may exceed the limit, and write bytes using
* write(byte[] b) is overrode in this class. In conclusion, the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

override

this.file.close();
}

protected void require(int size) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add @OverRide

try (FileOutputStream fos = new FileOutputStream(file);
DataOutputStream dos = new DataOutputStream(fos)) {
try {
BufferedFileOutput dos = new BufferedFileOutput(file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try (BufferedFileOutput dos = new BufferedFileOutput(file)) {
...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't read the data in try, the dos in try only auto close after try.

throw new IOException(String.format(
"The position %s is out of range [%s, %s]",
position, this.outputOffset,
this.outputOffset + this.bufferCapacity));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upper bound is this.position()

return this.in.readInt();
}

public int readFullInt() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add final

@houzhizhen houzhizhen dismissed stale reviews from coderzc and javeme via 20b4c14 March 10, 2021 11:44
Linary
Linary previously approved these changes Mar 10, 2021
javeme
javeme previously approved these changes Mar 10, 2021
}
endTime = System.currentTimeMillis();
time = endTime - startTime;
LOG.info("Read {} bytes use DataInputStream.readFully takes{} ms",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect space after "takes"


private static BufferedFileOutput createOutput(File file)
throws FileNotFoundException {
return new BufferedFileOutput(new RandomAccessFile(file, "rw"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use const


private static BufferedFileInput createInput(File file)
throws IOException {
return new BufferedFileInput(new RandomAccessFile(file, "rw"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

// Middle of current buffer
output.writeInt(200, 2);
output.writeInt(252, 3);
// Previous buffer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update comment

Assert.assertContains("underflows the start position",
e.getMessage());
});
Assert.assertThrows(IOException.class, () -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment

Assert.assertContains("out of range", e.getMessage());
});


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty lines

GraphOutputFactory.create(
OutputFormat.CSV, dos);
output.writeVertex(vertex);
dos.close();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to call flush()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close is better, it calls flush and close other resource.


@Test
public void testConstructor() throws IOException {
File file = this.createTempFile();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 spaces

@houzhizhen houzhizhen dismissed stale reviews from javeme and Linary via 2104b2c March 11, 2021 03:08
@houzhizhen houzhizhen merged commit 128ce85 into master Mar 11, 2021
@houzhizhen houzhizhen deleted the input-output branch March 11, 2021 03:41
yandababa2 pushed a commit to yandababa2/hugegraph-computer that referenced this pull request Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants