@Test public void readAsUINT128() throws IOException { byte[] given = UINT128.MAX_VALUE.bytes(); InputStream givenInputStream = new ByteArrayInputStream(given); PtpInputStream pis = new PtpInputStream(givenInputStream); UINT128 expected = UINT128.MAX_VALUE; UINT128 actual = (UINT128) pis.readAs(DataType.UINT128); assertThat(actual, is(expected)); }
public Object readAs(DataType dataType) throws IOException { Validators.notNull("dataType", dataType); switch (dataType) { case INT8: return readINT8(); case UINT8: return readUINT8(); case INT16: return readINT16(); case UINT16: return readUINT16(); case INT32: return readINT32(); case UINT32: return readUINT32(); case INT64: return readINT64(); case UINT64: return readUINT64(); case INT128: return readINT128(); case UINT128: return readUINT128(); case AINT8: return readAINT8(); case AUINT8: return readAUINT8(); case AINT16: return readAINT16(); case AUINT16: return readAUINT16(); case AINT32: return readAINT32(); case AUINT32: return readAUINT32(); case AINT64: return readAINT64(); case AUINT64: return readAUINT64(); case AINT128: return readAINT128(); case AUINT128: return readAUINT128(); case STR: return readString(); default: throw new UnsupportedOperationException(dataType + " is not supported."); } }
PtpInputStream extends InputStream { public Object readAs(DataType dataType) throws IOException { Validators.notNull("dataType", dataType); switch (dataType) { case INT8: return readINT8(); case UINT8: return readUINT8(); case INT16: return readINT16(); case UINT16: return readUINT16(); case INT32: return readINT32(); case UINT32: return readUINT32(); case INT64: return readINT64(); case UINT64: return readUINT64(); case INT128: return readINT128(); case UINT128: return readUINT128(); case AINT8: return readAINT8(); case AUINT8: return readAUINT8(); case AINT16: return readAINT16(); case AUINT16: return readAUINT16(); case AINT32: return readAINT32(); case AUINT32: return readAUINT32(); case AINT64: return readAINT64(); case AUINT64: return readAUINT64(); case AINT128: return readAINT128(); case AUINT128: return readAUINT128(); case STR: return readString(); default: throw new UnsupportedOperationException(dataType + " is not supported."); } } }
PtpInputStream extends InputStream { public Object readAs(DataType dataType) throws IOException { Validators.notNull("dataType", dataType); switch (dataType) { case INT8: return readINT8(); case UINT8: return readUINT8(); case INT16: return readINT16(); case UINT16: return readUINT16(); case INT32: return readINT32(); case UINT32: return readUINT32(); case INT64: return readINT64(); case UINT64: return readUINT64(); case INT128: return readINT128(); case UINT128: return readUINT128(); case AINT8: return readAINT8(); case AUINT8: return readAUINT8(); case AINT16: return readAINT16(); case AUINT16: return readAUINT16(); case AINT32: return readAINT32(); case AUINT32: return readAUINT32(); case AINT64: return readAINT64(); case AUINT64: return readAUINT64(); case AINT128: return readAINT128(); case AUINT128: return readAUINT128(); case STR: return readString(); default: throw new UnsupportedOperationException(dataType + " is not supported."); } } PtpInputStream(InputStream in); }
PtpInputStream extends InputStream { public Object readAs(DataType dataType) throws IOException { Validators.notNull("dataType", dataType); switch (dataType) { case INT8: return readINT8(); case UINT8: return readUINT8(); case INT16: return readINT16(); case UINT16: return readUINT16(); case INT32: return readINT32(); case UINT32: return readUINT32(); case INT64: return readINT64(); case UINT64: return readUINT64(); case INT128: return readINT128(); case UINT128: return readUINT128(); case AINT8: return readAINT8(); case AUINT8: return readAUINT8(); case AINT16: return readAINT16(); case AUINT16: return readAUINT16(); case AINT32: return readAINT32(); case AUINT32: return readAUINT32(); case AINT64: return readAINT64(); case AUINT64: return readAUINT64(); case AINT128: return readAINT128(); case AUINT128: return readAUINT128(); case STR: return readString(); default: throw new UnsupportedOperationException(dataType + " is not supported."); } } PtpInputStream(InputStream in); INT8 readINT8(); UINT8 readUINT8(); INT16 readINT16(); UINT16 readUINT16(); INT32 readINT32(); UINT32 readUINT32(); INT64 readINT64(); UINT64 readUINT64(); INT128 readINT128(); UINT128 readUINT128(); List<INT8> readAINT8(); List<UINT8> readAUINT8(); List<INT16> readAINT16(); List<UINT16> readAUINT16(); List<INT32> readAINT32(); List<UINT32> readAUINT32(); List<INT64> readAINT64(); List<UINT64> readAUINT64(); List<INT128> readAINT128(); List<UINT128> readAUINT128(); String readString(); Object readAs(DataType dataType); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override int available(); @Override void close(); @Override void mark(int readlimit); @Override void reset(); @Override boolean markSupported(); }
PtpInputStream extends InputStream { public Object readAs(DataType dataType) throws IOException { Validators.notNull("dataType", dataType); switch (dataType) { case INT8: return readINT8(); case UINT8: return readUINT8(); case INT16: return readINT16(); case UINT16: return readUINT16(); case INT32: return readINT32(); case UINT32: return readUINT32(); case INT64: return readINT64(); case UINT64: return readUINT64(); case INT128: return readINT128(); case UINT128: return readUINT128(); case AINT8: return readAINT8(); case AUINT8: return readAUINT8(); case AINT16: return readAINT16(); case AUINT16: return readAUINT16(); case AINT32: return readAINT32(); case AUINT32: return readAUINT32(); case AINT64: return readAINT64(); case AUINT64: return readAUINT64(); case AINT128: return readAINT128(); case AUINT128: return readAUINT128(); case STR: return readString(); default: throw new UnsupportedOperationException(dataType + " is not supported."); } } PtpInputStream(InputStream in); INT8 readINT8(); UINT8 readUINT8(); INT16 readINT16(); UINT16 readUINT16(); INT32 readINT32(); UINT32 readUINT32(); INT64 readINT64(); UINT64 readUINT64(); INT128 readINT128(); UINT128 readUINT128(); List<INT8> readAINT8(); List<UINT8> readAUINT8(); List<INT16> readAINT16(); List<UINT16> readAUINT16(); List<INT32> readAINT32(); List<UINT32> readAUINT32(); List<INT64> readAINT64(); List<UINT64> readAUINT64(); List<INT128> readAINT128(); List<UINT128> readAUINT128(); String readString(); Object readAs(DataType dataType); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override int available(); @Override void close(); @Override void mark(int readlimit); @Override void reset(); @Override boolean markSupported();  }