Vladimir Steshin created IGNITE-15350:
-----------------------------------------

             Summary: Refactor EncryptedFileIO
                 Key: IGNITE-15350
                 URL: https://issues.apache.org/jira/browse/IGNITE-15350
             Project: Ignite
          Issue Type: Task
            Reporter: Vladimir Steshin


Current EncryptedFileIO has wierd implementations of several methods. Like 
{code:java}
@Override public int write(byte[] buf, int off, int len) throws IOException {
        throw new UnsupportedOperationException("Encrypted File doesn't support 
this operation");
    }
{code}

    @Override public int read(byte[] buf, int off, int len) throws IOException {
        throw new UnsupportedOperationException("Encrypted File doesn't support 
this operation");
    }
Why not supported?

Or: 

{code:java}
@Override public int read(ByteBuffer destBuf) throws IOException {
        assert position() == 0;

        return plainFileIO.read(destBuf);
    }
{code}
Why encrypted reading is not supported beyond the header? Why `assert 
position() == 0`

The class contains several writes and reading implemented differently. Some of 
them are not supported.

Suggestion: Make one write(...) and one read(...) implementation and call them 
passing correct arguments. Read/write the header without encryption. Read/write 
everything beyond the header with encryption.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to