/** * Create a {@code ByteInput} wrapper for an {@code InputStream}. * * @param inputStream the input stream * @return the byte input wrapper */ public static ByteInput createByteInput(final InputStream inputStream) { return inputStream instanceof ByteInput ? (ByteInput) inputStream : new InputStreamByteInput(inputStream); }
private Object unmarshalIdentifier() throws IOException, ClassNotFoundException { final Object id; try { final byte[] idData = poaCurrent.get_object_id(); final Unmarshaller unmarshaller = factory.createUnmarshaller(configuration); unmarshaller.start(new InputStreamByteInput(new ByteArrayInputStream(idData))); id = unmarshaller.readObject(); unmarshaller.finish(); } catch (NoContext noContext) { throw new RuntimeException(noContext); } return id; }
public Object deSerialize(final String data) throws SQLException { if (data == null) { return null; } InputStream in = new ByteArrayInputStream(Base64.getDecoder().decode(data)); try { final Unmarshaller unmarshaller = factory.createUnmarshaller(configuration); unmarshaller.start(new InputStreamByteInput(in)); Object ret = unmarshaller.readObject(); unmarshaller.finish(); return ret; } catch (IOException e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { safeClose(in); } }
@Override protected Map<String, SessionEntry> loadSerializedSessions(String deploymentName) throws IOException { File file = new File(baseDir, deploymentName); if (!file.exists()) { return null; } FileInputStream in = new FileInputStream(file); try { Unmarshaller unMarshaller = createUnmarshaller(); try { try { unMarshaller.start(new InputStreamByteInput(in)); return (Map<String, SessionEntry>) unMarshaller.readObject(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { unMarshaller.finish(); } } finally { unMarshaller.close(); } } finally { IoUtils.safeClose(in); } }
@Override protected final Object doOperation(HttpServerExchange exchange, String name) throws NamingException { ContentType contentType = ContentType.parse(exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE)); if (contentType == null || !contentType.getType().equals("application/x-wf-jndi-jbmar-value") || contentType.getVersion() != 1) { exchange.setStatusCode(StatusCodes.BAD_REQUEST); exchange.endExchange(); return null; } final MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration(); marshallingConfiguration.setVersion(2); try (InputStream inputStream = exchange.getInputStream()) { Unmarshaller unmarshaller = MARSHALLER_FACTORY.createUnmarshaller(marshallingConfiguration); unmarshaller.start(new InputStreamByteInput(inputStream)); Object object = unmarshaller.readObject(); unmarshaller.finish(); doOperation(name, object); } catch (Exception e) { NamingException nm = new NamingException(e.getMessage()); nm.initCause(e); throw nm; } return null; }
try { Unmarshaller unmarshaller = targetContext.createUnmarshaller(createMarshallingConf()); unmarshaller.start(new InputStreamByteInput(result)); int length = unmarshaller.readInt(); Xid[] ret = new Xid[length];
final MarshallingConfiguration marshallingConfiguration = createMarshallingConfig(providerUri); final Unmarshaller unmarshaller = targetContext.createUnmarshaller(marshallingConfiguration); unmarshaller.start(new InputStreamByteInput(input)); returned = unmarshaller.readObject();
try { Unmarshaller unmarshaller = targetContext.createUnmarshaller(createMarshallingConf()); unmarshaller.start(new InputStreamByteInput(result)); int formatId = unmarshaller.readInt(); int len = unmarshaller.readInt();
try { in = new FileInputStream(timerFile); unmarshaller.start(new InputStreamByteInput(in));
unmarshaller.start(new InputStreamByteInput(inputStream)); txConfig = readTransaction(unmarshaller); unmarshaller.finish();
@Override public final void handleRequest(HttpServerExchange exchange) throws Exception { ContentType contentType = ContentType.parse(exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE)); if (contentType == null || contentType.getVersion() != 1 || !contentType.getType().equals(TransactionConstants.XID)) { exchange.setStatusCode(StatusCodes.BAD_REQUEST); HttpRemoteTransactionMessages.MESSAGES.debugf("Exchange %s has incorrect or missing content type", exchange); return; } try { Unmarshaller unmarshaller = MARSHALLER_FACTORY.createUnmarshaller(createMarshallingConf()); unmarshaller.start(new InputStreamByteInput(exchange.getInputStream())); int formatId = unmarshaller.readInt(); int len = unmarshaller.readInt(); byte[] globalId = new byte[len]; unmarshaller.readFully(globalId); len = unmarshaller.readInt(); byte[] branchId = new byte[len]; unmarshaller.readFully(branchId); SimpleXid simpleXid = new SimpleXid(formatId, globalId, branchId); unmarshaller.finish(); ImportResult<LocalTransaction> transaction = transactionContext.findOrImportTransaction(simpleXid, 0); transaction.getTransaction().performFunction((ExceptionBiFunction<ImportResult<LocalTransaction>, HttpServerExchange, Void, Exception>) (o, exchange2) -> { handleImpl(exchange2, o); return null; }, transaction, exchange); } catch (Exception e) { sendException(exchange, StatusCodes.INTERNAL_SERVER_ERROR, e); } }
/** * Create a {@code ByteInput} wrapper for an {@code InputStream}. * * @param inputStream the input stream * @return the byte input wrapper */ public static ByteInput createByteInput(final InputStream inputStream) { return inputStream instanceof ByteInput ? (ByteInput) inputStream : new InputStreamByteInput(inputStream); }
/** * Create a {@code ByteInput} wrapper for an {@code InputStream}. * * @param inputStream the input stream * @return the byte input wrapper */ public static ByteInput createByteInput(final InputStream inputStream) { return inputStream instanceof ByteInput ? (ByteInput) inputStream : new InputStreamByteInput(inputStream); }
/** * Create a {@code ByteInput} wrapper for an {@code InputStream}. * * @param inputStream the input stream * @return the byte input wrapper */ public static ByteInput createByteInput(final InputStream inputStream) { return inputStream instanceof ByteInput ? (ByteInput) inputStream : new InputStreamByteInput(inputStream); }
/** * Create a {@code ByteInput} wrapper for an {@code InputStream}. * * @param inputStream the input stream * @return the byte input wrapper */ public static ByteInput createByteInput(final InputStream inputStream) { return inputStream instanceof ByteInput ? (ByteInput) inputStream : new InputStreamByteInput(inputStream); }
/** * Create a {@code ByteInput} wrapper for an {@code InputStream}. * * @param inputStream the input stream * @return the byte input wrapper */ public static ByteInput createByteInput(final InputStream inputStream) { return inputStream instanceof ByteInput ? (ByteInput) inputStream : new InputStreamByteInput(inputStream); }
private Object unmarshalIdentifier() throws IOException, ClassNotFoundException { final Object id; try { final byte[] idData = poaCurrent.get_object_id(); final Unmarshaller unmarshaller = factory.createUnmarshaller(configuration); unmarshaller.start(new InputStreamByteInput(new ByteArrayInputStream(idData))); id = unmarshaller.readObject(); unmarshaller.finish(); } catch (NoContext noContext) { throw new RuntimeException(noContext); } return id; }
@Override protected Map<String, SessionEntry> loadSerializedSessions(String deploymentName) throws IOException { File file = new File(baseDir, deploymentName); if (!file.exists()) { return null; } FileInputStream in = new FileInputStream(file); try { Unmarshaller unMarshaller = createUnmarshaller(); try { try { unMarshaller.start(new InputStreamByteInput(in)); return (Map<String, SessionEntry>) unMarshaller.readObject(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { unMarshaller.finish(); } } finally { unMarshaller.close(); } } finally { IoUtils.safeClose(in); } }
@Override protected Map<String, SessionEntry> loadSerializedSessions(String deploymentName) throws IOException { File file = new File(baseDir, deploymentName); if (!file.exists()) { return null; } FileInputStream in = new FileInputStream(file); try { Unmarshaller unMarshaller = createUnmarshaller(); try { try { unMarshaller.start(new InputStreamByteInput(in)); return (Map<String, SessionEntry>) unMarshaller.readObject(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { unMarshaller.finish(); } } finally { unMarshaller.close(); } } finally { IoUtils.safeClose(in); } }
try { in = new FileInputStream(timerFile); unmarshaller.start(new InputStreamByteInput(in)); final TimerEntity entity = unmarshaller.readObject(TimerEntity.class); timers.put(entity.getId(), entity);