if (representation != null) { final PipeStream pipe = new PipeStream();    Thread writer = new Thread() { public void run() { try { OutputStream os = pipe.getOutputStream(); representation.write(os); os.write(-1); os.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } };   writer.start(); return pipe.getInputStream(); } else { return null; }
return (readableChannel != null) ? Channels.newInputStream(readableChannel) : null;
	public static InputStream getStream(final Representation representation)			throws IOException	{		if (representation != null)		{			final PipeStream pipe = new PipeStream();			// Create a thread that will handle the task of continuously			// writing the representation into the input side of the pipe			Thread writer = new Thread()			{				public void run()				{					try					{						OutputStream os = pipe.getOutputStream();						representation.write(os);						os.write(-1);						os.close();					}					catch (IOException ioe)					{						ioe.printStackTrace();					}				}			};			// Start the writer thread			writer.start();			return pipe.getInputStream();		}		else		{			return null;		}	}