Example usage for java.lang UnsupportedOperationException UnsupportedOperationException

List of usage examples for java.lang UnsupportedOperationException UnsupportedOperationException

Introduction

In this page you can find the example usage for java.lang UnsupportedOperationException UnsupportedOperationException.

Prototype

public UnsupportedOperationException() 

Source Link

Document

Constructs an UnsupportedOperationException with no detail message.

Usage

From source file:Main.java

/**
 * Converts a byte array to a long. Halfwords can be swapped by setting
 * swapHalfWord=true.//  w  ww  . j  a va  2  s . c om
 * 
 * @param number
 *            An array of bytes containing a number
 * @param swapHalfWord
 *            Swap halfwords ([0][1][2][3]->[1][0][3][2])
 * @return The long value
 * @throws UnsupportedOperationException if number length is not a multiple of 2
 */
static long byteArray2long(final byte[] number, final boolean swapHalfWord) {
    if (number.length % 2 != 0) {
        throw new UnsupportedOperationException();
    }

    long ret = 0;
    int pos = 0;
    byte tmp_number[] = new byte[number.length];
    System.arraycopy(number, 0, tmp_number, 0, number.length);

    if (!swapHalfWord) {
        byte tmp = 0;
        for (pos = 0; pos < tmp_number.length; pos++) {
            tmp = tmp_number[pos];
            tmp_number[pos++] = tmp_number[pos];
            tmp_number[pos] = tmp;
        }
    }

    ret = tmp_number[0] & 0xFF;
    for (pos = 1; pos < tmp_number.length; pos++) {
        ret <<= 8;
        ret |= tmp_number[pos] & 0xFF;
    }
    return ret;
}

From source file:Main.java

public static Iterable<Node> iterateOverChildren(final Node element) {
    return new Iterable<Node>() {

        NodeList childNodes = element.getChildNodes();
        int itemIndex = 0;
        int nItems = childNodes.getLength();

        @Override//  w  w w . j  av  a  2  s .  co  m
        public Iterator<Node> iterator() {
            return new Iterator<Node>() {

                @Override
                public void remove() {
                    throw new UnsupportedOperationException();
                }

                @Override
                public Node next() {
                    return childNodes.item(itemIndex++);
                }

                @Override
                public boolean hasNext() {
                    return itemIndex < nItems;
                }
            };
        }
    };
}

From source file:net.radai.beanz.util.ReflectionUtil.java

public static Class<?> erase(Type type) {
    if (type instanceof GenericArrayType) {
        return Object.class; //TODO - get more info?
    }/*from   w  w  w .  j  a  v a  2 s.c  o  m*/
    if (type instanceof WildcardType) {
        throw new UnsupportedOperationException();
    }
    if (type instanceof TypeVariable) {
        throw new UnsupportedOperationException();
    }
    if (type instanceof ParameterizedType) {
        ParameterizedType parameterizedType = (ParameterizedType) type;
        return (Class) parameterizedType.getRawType();
    }
    return (Class) type;
}

From source file:Util.java

/**
 * Renvoie les lments enfants (uniquement de type ELEMENT)
 * //from ww w  .  j a  va2  s.  c om
 * @param e
 * @return
 */
public static Iterable<Element> getChildElements(final Element e) {
    return new Iterable<Element>() {
        public Iterator<Element> iterator() {
            final NodeList list = e.getChildNodes();
            int i = 0;
            for (; i < list.getLength(); i++) {
                if (list.item(i).getNodeType() == Node.ELEMENT_NODE)
                    break;
            }
            final int init = i;
            return new Iterator<Element>() {
                int cur = init;

                public void remove() {
                    throw new UnsupportedOperationException();
                }

                public Element next() {
                    Element item = (Element) list.item(cur);
                    for (cur++; cur < list.getLength(); cur++) {
                        if (list.item(cur).getNodeType() == Node.ELEMENT_NODE)
                            break;
                    }
                    return item;
                }

                public boolean hasNext() {
                    return cur < list.getLength();
                }

            };
        }
    };
}

From source file:Main.java

/**
 * Converts a long number to a byte array 
 * Halfwords can be swapped by setting swapHalfWord=true.
 * /* w  w  w  . j  a v  a  2  s.  co  m*/
 * @param number 
 *            the input long number to be converted
 *            
 * @param length
 *            The length of the returned array
 * @param swapHalfWord
 *            Swap halfwords ([0][1][2][3]->[1][0][3][2])
 * @return The long value
 * @throws UnsupportedOperationException if the length is not a positive multiple of two
 */
static byte[] long2byteArray(final long number, final int length, final boolean swapHalfWord) {
    byte[] ret = new byte[length];
    int pos = 0;
    long tmp_number = 0;

    if (length % 2 != 0 || length < 2) {
        throw new UnsupportedOperationException();
    }

    tmp_number = number;
    for (pos = length - 1; pos >= 0; pos--) {
        ret[pos] = (byte) (tmp_number & 0xFF);
        tmp_number >>= 8;
    }

    if (!swapHalfWord) {
        byte tmp = 0;
        for (pos = 0; pos < length; pos++) {
            tmp = ret[pos];
            ret[pos++] = ret[pos];
            ret[pos] = tmp;
        }
    }

    return ret;
}

From source file:IterableString.java

public void remove() {
    throw new UnsupportedOperationException();
}

From source file:com.creditcloud.service.impl.AbstractMarketCustomizeService.java

@Override
public int addWechatInfos(List<WechatInfo> wis) {
    throw new UnsupportedOperationException();
}

From source file:springfox.documentation.swagger.common.SwaggerPluginSupport.java

private SwaggerPluginSupport() {
    throw new UnsupportedOperationException();
}

From source file:Main.java

static Iterable<JavaSourceFromString> getJavaSourceFromString(String code) {
    final JavaSourceFromString jsfs = new JavaSourceFromString("code", code);
    return new Iterable<JavaSourceFromString>() {
        public Iterator<JavaSourceFromString> iterator() {
            return new Iterator<JavaSourceFromString>() {
                boolean isNext = true;

                public boolean hasNext() {
                    return isNext;
                }//from   ww w.j av  a2 s  . c  o m

                public JavaSourceFromString next() {
                    if (!isNext)
                        throw new NoSuchElementException();
                    isNext = false;
                    return jsfs;
                }

                public void remove() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    };
}

From source file:edu.usc.goffish.gofs.namenode.NameNodeProvider.java

private NameNodeProvider() {
    throw new UnsupportedOperationException();
}