本文整理汇总了Java中com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream类的典型用法代码示例。如果您正苦于以下问题:Java ByteBufferBackedInputStream类的具体用法?Java ByteBufferBackedInputStream怎么用?Java ByteBufferBackedInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteBufferBackedInputStream类属于com.fasterxml.jackson.databind.util包,在下文中一共展示了ByteBufferBackedInputStream类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: apply
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; //导入依赖的package包/类
@Override
public List<CSVReportEntry> apply(final GetCredentialReportResult report) {
Assert.state(Textcsv.toString().equals(report.getReportFormat()), "unknown credential report format: " + report.getReportFormat());
try (final Reader r = new BufferedReader(new InputStreamReader(new ByteBufferBackedInputStream(report.getContent())))) {
final CSVParser parser = new CSVParser(r, CSV_FORMAT);
final Map<String, Integer> headers = parser.getHeaderMap();
Assert.state(headers.containsKey("user"), "Header 'user' not found in CSV");
Assert.state(headers.containsKey("arn"), "Header 'arn' not found in CSV");
Assert.state(headers.containsKey("password_enabled"), "Header 'password_enabled' not found in CSV");
Assert.state(headers.containsKey("mfa_active"), "Header 'mfa_active' not found in CSV");
Assert.state(headers.containsKey("access_key_1_active"), "Header 'access_key_1_active' not found in CSV");
Assert.state(headers.containsKey("access_key_2_active"), "Header 'access_key_2_active' not found in CSV");
return stream(parser.spliterator(), false).map(this::toCSVReportEntry).filter(Objects::nonNull).collect(toList());
} catch (final IOException e) {
throw new RuntimeException("Could not read csv report", e);
}
}
开发者ID:zalando-stups,项目名称:fullstop,代码行数:21,代码来源:CredentialReportCSVParserImpl.java
示例2: deserialize
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; //导入依赖的package包/类
/**
* Deserializes the given message.
*
* @param action
* @return
* @throws Exception
*/
public T deserialize(WebSocketAction action) throws Exception {
// first deserialize
T message = null;
if (messageClass != null) {
message = serDe.deserialize(new ByteBufferBackedInputStream(rawData), messageClass);
}
// then validate
if (message != null && action.shouldValidatePayload()) {
SpringValidatorAdapter validatorAdapter = new SpringValidatorAdapter(messageValidator);
BeanPropertyBindingResult result = new BeanPropertyBindingResult(message, messageClass.getName());
validatorAdapter.validate(message, result);
if (result.hasErrors()) {
throw new MethodArgumentNotValidException(new MethodParameter(action.getMethod(), action.getPayloadParameterIndex()), result);
}
}
return message;
}
开发者ID:Kixeye,项目名称:chassis,代码行数:31,代码来源:RawWebSocketMessage.java
示例3: deserialize
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; //导入依赖的package包/类
@Override
public <U> U deserialize(BinaryData rawPayload, Class<U> targetType) {
try {
return objectMapper.readValue(new ByteBufferBackedInputStream(rawPayload.toByteBuffer()), targetType);
} catch (IOException e) {
throw new IllegalArgumentException("Error deserializing payload", e);
}
}
开发者ID:unbroken-dome,项目名称:jsonwebtoken,代码行数:9,代码来源:DefaultPayloadDeserializer.java
示例4: deserialize
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public JoseHeader deserialize(BinaryData data) throws JwtMalformedTokenException {
try {
Map<String, Object> headerValues = objectMapper.readValue(
new ByteBufferBackedInputStream(data.toByteBuffer()), Map.class);
return new DefaultJoseHeader(headerValues);
} catch (IOException e) {
throw new JwtMalformedTokenException("Error deserializing JWS header", e);
}
}
开发者ID:unbroken-dome,项目名称:jsonwebtoken,代码行数:12,代码来源:DefaultHeaderDeserializer.java
示例5: decode
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; //导入依赖的package包/类
@Override
public T decode(ByteBuffer bytes) throws DecodeException {
try {
return mapper.readValue(new ByteBufferBackedInputStream(bytes), objectClass);
} catch (IOException e) {
throw new DecodeException(bytes, "decode json error", e);
}
}
开发者ID:icode,项目名称:ameba,代码行数:9,代码来源:JacksonDecoder.java
示例6: willDecode
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; //导入依赖的package包/类
@Override
public boolean willDecode(ByteBuffer bytes) {
try {
mapper.readTree(new ByteBufferBackedInputStream(bytes));
} catch (IOException e) {
logger.warn("invalidate json", e);
return false;
}
return true;
}
开发者ID:icode,项目名称:ameba,代码行数:11,代码来源:JacksonDecoder.java
示例7: readData
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; //导入依赖的package包/类
/**
* Reads the data field of the record. If the record is compressed, this
* will involve decompressing it. Currently both bz2 and lz4 compression
* are supported.
* Do not call this method more than once, and do not call it if the channel
* used to create this record has been closed.
* @throws BagReaderException
*/
public void readData() throws BagReaderException {
myData = ByteBuffer.allocate(myDataLength);
try {
myChannel.position(myDataOffset);
myChannel.read(myData);
// Chunks can have bz2 or lz4-compressed myData in them, which we need to
// decompress in order to do anything useful with.
if (myHeader.getType() == RecordType.CHUNK) {
String compression = myHeader.getValue("compression");
switch (compression) {
case "none":
// Do nothing here if not compressed
break;
case "bz2":
case "lz4":
{
int decompressedSize = myHeader.getInt("size");
myData.flip();
try (ByteBufferBackedInputStream inStream = new ByteBufferBackedInputStream(myData);
InputStream compressedStream = openCompressedStream(compression, inStream)) {
final byte[] buffer = new byte[decompressedSize];
int n = IOUtils.readFully(compressedStream, buffer);
if (n != decompressedSize) {
throw new BagReaderException("Read " + n + " bytes from a " +
"compressed chunk but expected " +
decompressedSize + ".");
}
myData = ByteBuffer.wrap(buffer);
}
break;
}
default:
myLogger.warn("Unknown compression format: " + compression);
break;
}
}
myData.order(ByteOrder.LITTLE_ENDIAN);
}
catch (IOException e) {
throw new BagReaderException(e);
}
}
开发者ID:swri-robotics,项目名称:bag-reader-java,代码行数:53,代码来源:Record.java
注:本文中的com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论