Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1256f019 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 6399

* changes:
  Obex library cleanup, third pass
parents c426d830 3998bf00
Loading
Loading
Loading
Loading
+18 −24
Original line number Diff line number Diff line
@@ -37,9 +37,11 @@ package javax.obex;
 */
public final class ApplicationParameter {

    private byte[] b_array;
    private int length;
    private int max_length = 1000;
    private byte[] mArray;

    private int mLength;

    private int mMaxLength = 1000;

    public static class TRIPLET_TAGID {
        public static final byte ORDER_TAGID = 0x01;
@@ -91,7 +93,6 @@ public final class ApplicationParameter {
    public static class TRIPLET_LENGTH {
        public static final byte ORDER_LENGTH = 1;

        //public final byte SEARCH_VALUE_LENGTH = 0x02;
        public static final byte SEARCH_ATTRIBUTE_LENGTH = 1;

        public static final byte MAXLISTCOUNT_LENGTH = 2;
@@ -107,34 +108,27 @@ public final class ApplicationParameter {
        public static final byte NEWMISSEDCALLS_LENGTH = 1;
    }

    /*
    public class TRIPLET_STRUCTURE{
        TRIPLET_TAGID id;
        TRIPLET_LENGTH length;
        byte[] value;
    }
    */
    public ApplicationParameter() {
        b_array = new byte[max_length];
        length = 0;
        mArray = new byte[mMaxLength];
        mLength = 0;
    }

    public void addAPPHeader(byte tag, byte len, byte[] value) {
        if ((length + len + 2) > max_length) {
            byte[] array_tmp = new byte[length + 4 * len];
            System.arraycopy(b_array, 0, array_tmp, 0, length);
            b_array = array_tmp;
            max_length = length + 4 * len;
        if ((mLength + len + 2) > mMaxLength) {
            byte[] array_tmp = new byte[mLength + 4 * len];
            System.arraycopy(mArray, 0, array_tmp, 0, mLength);
            mArray = array_tmp;
            mMaxLength = mLength + 4 * len;
        }
        b_array[length++] = tag;
        b_array[length++] = len;
        System.arraycopy(value, 0, b_array, length, len);
        length += len;
        mArray[mLength++] = tag;
        mArray[mLength++] = len;
        System.arraycopy(value, 0, mArray, mLength, len);
        mLength += len;
    }

    public byte[] getAPPparam() {
        byte[] para = new byte[length];
        System.arraycopy(b_array, 0, para, 0, length);
        byte[] para = new byte[mLength];
        System.arraycopy(mArray, 0, para, 0, mLength);
        return para;
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -106,8 +106,8 @@ public interface Authenticator {
     * @return a <code>PasswordAuthentication</code> object containing the
     * user name and password used for authentication
     */
    public PasswordAuthentication onAuthenticationChallenge(String description,
            boolean isUserIdRequired, boolean isFullAccess);
    PasswordAuthentication onAuthenticationChallenge(String description, boolean isUserIdRequired,
            boolean isFullAccess);

    /**
     * Called when a client or server receives an authentication response
@@ -120,5 +120,5 @@ public interface Authenticator {
     * @return the correct password for the user name provided; if
     * <code>null</code> is returned then the authentication request failed
     */
    public byte[] onAuthenticationResponse(byte[] userName);
    byte[] onAuthenticationResponse(byte[] userName);
}
+4 −4
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public interface BaseStream {
     *
     * @throws IOException if the object is closed
     */
    public void ensureOpen() throws IOException;
    void ensureOpen() throws IOException;

    /**
     * Verifies that additional information may be sent.  In other words, the
@@ -55,7 +55,7 @@ public interface BaseStream {
     *
     * @throws IOException if the operation is completed
     */
    public void ensureNotDone() throws IOException;
    void ensureNotDone() throws IOException;

    /**
     * Continues the operation since there is no data to read.
@@ -69,7 +69,7 @@ public interface BaseStream {
     *
     * @throws IOException if an IO error occurs
     */
    public boolean continueOperation(boolean sendEmpty, boolean inStream) throws IOException;
    boolean continueOperation(boolean sendEmpty, boolean inStream) throws IOException;

    /**
     * Called when the output or input stream is closed.
@@ -79,5 +79,5 @@ public interface BaseStream {
     *
     * @throws IOException if an IO error occurs
     */
    public void streamClosed(boolean inStream) throws IOException;
    void streamClosed(boolean inStream) throws IOException;
}
Loading