Skip to content

Commit

Permalink
Merge pull request #10 from zongsizhang/master
Browse files Browse the repository at this point in the history
Fix readInt bug when loading shapefiles from HDFS
  • Loading branch information
jiayuasu authored Jul 31, 2017
2 parents 0281d84 + 44ec302 commit 30806a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,26 @@ public double readDouble() throws IOException {
*/
@Override
public int readInt() throws IOException {
return inputStream.readInt();
byte[] intbytes = new byte[ShapeFileConst.INT_LENGTH];
this.read(intbytes);

return ByteBuffer.wrap(intbytes).getInt();
}

/* (non-Javadoc)
* @see org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeReader#read(byte[])
*/
@Override
public void read(byte[] bytes) throws IOException {
inputStream.read(bytes);
inputStream.readFully(bytes);
}

/* (non-Javadoc)
* @see org.datasyslab.geospark.formatMapper.shapefileParser.parseUtils.shp.ShapeReader#read(byte[], int, int)
*/
@Override
public void read(byte[] bytes, int offset, int len) throws IOException {
inputStream.read(bytes, offset, len);
inputStream.readFully(bytes, offset, len);
}

/* (non-Javadoc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.nio.ByteBuffer;

// TODO: Auto-generated Javadoc
/**
Expand Down

0 comments on commit 30806a0

Please sign in to comment.