List of usage examples for java.lang UnsupportedOperationException UnsupportedOperationException
public UnsupportedOperationException(Throwable cause)
From source file:Main.java
public static String trimStringValue(String value) { if (value == null) { return null; }/*w w w. j a v a 2 s .com*/ String text = value; char initialChar = text.charAt(0); if (text.charAt(text.length() - 1) != initialChar) { throw new IllegalArgumentException("malformed string literal"); } text = text.substring(1, text.length() - 1); if (initialChar == '\'') { text = text.replace("''", "'"); } else if (initialChar == '"') { text = text.replace("\"\"", "\""); } else { throw new UnsupportedOperationException("Not supported yet."); } return text; }
From source file:com.wormsim.animals.AnimalZoo2.java
public static AnimalZoo2 read(String p_str) throws IOException { throw new UnsupportedOperationException("NYI"); }
From source file:Main.java
public static long byteArray2long(byte[] signature) { if (signature.length > 8) throw new UnsupportedOperationException( "Cannot lossless convert byte array into long if length is greater than 8"); long val = 0; for (int i = signature.length - 1; i >= 0; i--) { val = val << 8; val |= signature[i]; }/* w w w .ja v a 2 s . c o m*/ return val; }
From source file:Main.java
public static byte bitString2byte(String str) { int res = 0;//from w w w .j a v a 2 s . co m if (str.length() > 8) throw new UnsupportedOperationException("string length may be max 8"); for (int i = 0; i < str.length(); i++) { res = res << 1; if ('1' == str.charAt(i)) { res |= 1; } else if ('0' == str.charAt(i)) { } else throw new UnsupportedOperationException("string may contain only 1 or 0"); } return (byte) res; }
From source file:Main.java
public static TimeUnit convert(ChronoUnit tu) { if (tu == null) { return null; }/* w w w . j a va 2 s . co m*/ switch (tu) { case DAYS: return TimeUnit.DAYS; case HOURS: return TimeUnit.HOURS; case MINUTES: return TimeUnit.MINUTES; case SECONDS: return TimeUnit.SECONDS; case MICROS: return TimeUnit.MICROSECONDS; case MILLIS: return TimeUnit.MILLISECONDS; case NANOS: return TimeUnit.NANOSECONDS; default: //TODO support the rest throw new UnsupportedOperationException("Man, use a real temporal unit"); } }
From source file:Main.java
public static long fromBitString2Long(String str) { if (str.length() > 64) { throw new UnsupportedOperationException( "Strings needs to fit into long (8*8 bits) but length was " + str.length()); }/* w w w .j av a 2 s. c o m*/ byte[] res = fromBitString(str); if (res.length < 8) { byte[] newBytes = new byte[8]; System.arraycopy(res, 0, newBytes, 8 - res.length, res.length); res = newBytes; } return toLong(res); }
From source file:Main.java
public static <T> Iterable<T> asIterable(final T[] a) { return new Iterable<T>() { @Override//from w ww . j a va2 s.com public Iterator<T> iterator() { return new Iterator<T>() { int index = 0; @Override public boolean hasNext() { return index < a.length; } @Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } return a[index++]; } @Override public void remove() { throw new UnsupportedOperationException("Not supported yet."); } }; } }; }
From source file:Main.java
private static boolean isDirect(Buffer buf) { if (buf instanceof FloatBuffer) { return ((FloatBuffer) buf).isDirect(); }/*from ww w .j a va 2s.c o m*/ if (buf instanceof IntBuffer) { return ((IntBuffer) buf).isDirect(); } if (buf instanceof ShortBuffer) { return ((ShortBuffer) buf).isDirect(); } if (buf instanceof ByteBuffer) { return ((ByteBuffer) buf).isDirect(); } if (buf instanceof DoubleBuffer) { return ((DoubleBuffer) buf).isDirect(); } if (buf instanceof LongBuffer) { return ((LongBuffer) buf).isDirect(); } throw new UnsupportedOperationException(" BufferUtils.isDirect was called on " + buf.getClass().getName()); }
From source file:Main.java
/** * Convert an array of {@code ints}s to an array of {@code byte}s which are treated as unsigned. * * @param sprite// w ww . j ava 2 s.c om * @return */ public static byte[] intsToUnsignedBytes(int[] sprite) { throw new UnsupportedOperationException("Not yet implemented"); }
From source file:Main.java
private static <E> Collection<E> asCollection(final E[] elements) { return new AbstractCollection<E>() { public Iterator<E> iterator() { return new Iterator<E>() { // Object field private int index = 0; // Interface methods public boolean hasNext() { return index < elements.length; }//from w ww . j av a 2 s . c om public E next() { if (!hasNext()) { throw new NoSuchElementException(); } return elements[index++]; } public void remove() { throw new UnsupportedOperationException("remove"); } }; } public int size() { return elements.length; } }; }