public int read(byte[] b, int off, int len) throws IOException { int total = 0; while (len > 0) { if (_chunk == null) { try { _chunk = nextChunk(); } catch (GeneralSecurityException e) { throw new EncryptedDocumentException(e.getMessage()); } } int count = (int)(4096L - (_pos & 0xfff)); count = Math.min(available(), Math.min(count, len)); System.arraycopy(_chunk, (int)(_pos & 0xfff), b, off, count); off += count; len -= count; _pos += count; if ((_pos & 0xfff) == 0) _chunk = null; total += count; } return total; }
public int read(byte[] b, int off, int len) throws IOException { int total = 0; while (len > 0) { if (_chunk == null) { try { _chunk = nextChunk(); } catch (GeneralSecurityException e) { throw new EncryptedDocumentException(e.getMessage()); } } int count = (int)(4096L - (_pos & 0xfff)); count = Math.min(available(), Math.min(count, len)); System.arraycopy(_chunk, (int)(_pos & 0xfff), b, off, count); off += count; len -= count; _pos += count; if ((_pos & 0xfff) == 0) _chunk = null; total += count; } return total; }
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
public int read(byte[] b) throws IOException { return read(b, 0, b.length); }
public InputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException { DocumentInputStream dis = dir.createDocumentInputStream("EncryptedPackage"); _length = dis.readLong(); return new ChunkedCipherInputStream(dis, _length); }
public long skip(long n) throws IOException { long start = _pos; long skip = Math.min(available(), n); if ((((_pos + skip) ^ start) & ~0xfff) != 0) _chunk = null; _pos += skip; return skip; }
public int read() throws IOException { byte[] b = new byte[1]; if (read(b) == 1) return b[0]; return -1; }
public int read() throws IOException { byte[] b = new byte[1]; if (read(b) == 1) return b[0]; return -1; }
public InputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException { DocumentInputStream dis = dir.createDocumentInputStream("EncryptedPackage"); _length = dis.readLong(); return new ChunkedCipherInputStream(dis, _length); }
public long skip(long n) throws IOException { long start = _pos; long skip = Math.min(available(), n); if ((((_pos + skip) ^ start) & ~0xfff) != 0) _chunk = null; _pos += skip; return skip; }