public int byteSize() { if (_curr instanceof IonLob) { IonLob lob = (IonLob) _curr; return lob.byteSize(); } throw new IllegalStateException("current value is not an ion blob or clob"); }
public byte[] newBytes() { if (_curr instanceof IonLob) { IonLob lob = (IonLob) _curr; int loblen = lob.byteSize(); byte[] buffer = new byte[loblen]; InputStream is = lob.newInputStream(); int retlen; try { retlen = readFully(is, buffer, 0, loblen); is.close(); } catch (IOException e) { throw new IonException(e); } assert (retlen == -1 ? loblen == 0 : retlen == loblen); return buffer; } throw new IllegalStateException("current value is not an ion blob or clob"); }
public int getBytes(byte[] buffer, int offset, int len) { if (_curr instanceof IonLob) { IonLob lob = (IonLob) _curr; int loblen = lob.byteSize(); if (loblen > len) { throw new IllegalArgumentException("insufficient space in buffer for this value"); } InputStream is = lob.newInputStream(); int retlen; try { retlen = readFully(is, buffer, 0, loblen); is.close(); } catch (IOException e) { throw new IonException(e); } assert retlen == loblen; return retlen; } throw new IllegalStateException("current value is not an ion blob or clob"); }