mrpdaemon / encfs-java

encfs-java is a Java library for accessing data in EncFS volumes
GNU Lesser General Public License v3.0
42 stars 15 forks source link

EncFSInputStream read returns negative chars #57

Closed uvilop closed 9 years ago

uvilop commented 10 years ago

this results in an exception wenn gunzipping an encfs stream:

java.io.IOException: org.mrpdaemon.sec.encfs.EncFSInputStream.read() returned value out of range -1..255: -117 at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:272)

read has to convert the byte to a positive int, eg by & 0xFF:

@Override public int read() throws IOException { byte[] oneByte = new byte[1]; int ret = this.read(oneByte, 0, 1); if (ret == 1) { return oneByte[0] & 0xFF; } return ret; }